Update and improve the comments hint computation for the diff viewer.

Review Request #13667 — Created March 25, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

This change makes major updates to the comments hint structure that gets
included in the diff viewer page data. The major driver for this is that
the old implementation did not include correct information about
comments that were made against commit ranges. It was also doing a bunch
of extra queries, using the database to generate the comments
information when we already had most of what we needed fetched.

This new implementation simplifies things a little bit by compting more
information at the ReviewsDiffViewerView level, passing it down to the
DiffViewerView, instead of letting the superclass do things and then
pull the data back out of the context structure.

This makes a couple other small improvements:

  • The social page info definitions have been consolidated into the base
    ReviewRequestContext, and arguments added to
    make_review_request_context to set them there.
  • The way that diff commits and other objects are queried has been
    simplified so we don't fetch things more than once.

This does not yet add UI for commit-specific comments.

  • Ran unit tests.
  • Tested all the different diff viewer views, including single diffs,
    interdiffs, and commit diffs.
  • Tested that the commit list and commit history diffs worked correctly.
  • Tested that the comments hint (in a future change) correctly listed
    all diffs, interdiffs, and commit range comments included in the
    pending review.

Diff Revision 2

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

orig
1
2
3
4
5
6

Commits

First Last Summary ID Author
Update and improve the comments hint computation for the diff viewer.
This change makes major updates to the comments hint structure that gets included in the diff viewer page data. The major driver for this is that the old implementation did not include correct information about comments that were made against commit ranges. It was also doing a bunch of extra queries, using the database to generate the comments information when we already had most of what we needed fetched. This new implementation simplifies things a little bit by compting more information at the ReviewsDiffViewerView level, passing it down to the DiffViewerView, instead of letting the superclass do things and then pull the data back out of the context structure. This makes a couple other small improvements: - The social page info definitions have been consolidated into the base ReviewRequestContext, and arguments added to make_review_request_context to set them there. - The way that diff commits and other objects are queried has been simplified so we don't fetch things more than once. This does not yet add UI for commit-specific comments. Testing Done: - Ran unit tests. - Tested all the different diff viewer views, including single diffs, interdiffs, and commit diffs. - Tested that the commit list and commit history diffs worked correctly.
0b6025eaf431c465d976eea4c44c88751be7c207 David Trowbridge
reviewboard/diffviewer/views.py
reviewboard/reviews/context.py
reviewboard/reviews/models/review_request.py
reviewboard/reviews/tests/test_review_request_page_data.py
reviewboard/reviews/ui/base.py
reviewboard/reviews/views/diffviewer.py
reviewboard/reviews/views/review_request_detail.py
Loading...