Avoid duplicate instantiation and rendering of review UIs in diffs.

Review Request #13534 — Created Feb. 12, 2024 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

When rendering review UIs into diffs, we'd end up creating instances for
both the original and modified files, even if we had a UI capable of
rendering a diff. This change makes it so we look up the matching Review
UI classes first and check if it's diff capable. If so, we only create
it once and use it to render the diff. If we have some other case (such
as only having one side or the other, or having a file type mismatch),
we'll instantiate each review UI and render the column.

Looked at a diff that had attachments for binary filediffs. Saw that
review UIs were instantiated and rendered correctly.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Avoid duplicate instantiation and rendering of review UIs in diffs.
When rendering review UIs into diffs, we'd end up creating instances for both the original and modified files, even if we had a UI capable of rendering a diff. This change makes it so we look up the matching Review UI classes first and check if it's diff capable. If so, we only create it once and use it to render the diff. If we have some other case (such as only having one side or the other, or having a file type mismatch), we'll instantiate each review UI and render the column. Testing Done: Looked at a diff that had attachments for binary filediffs. Saw that review UIs were instantiated and rendered correctly.
869558bfd9dd3b22908f7e6c885eebe31a6df198 David Trowbridge
reviewboard/reviews/views/diff_fragments.py
Loading...