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 2 (Latest)

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.
7681857eefa65fa5f12849951fca7fbc1ba9eab2 David Trowbridge
reviewboard/reviews/views/diff_fragments.py
Loading...