• 
      

    Allow ReviewRequestPageData to process draft diff comments.

    Review Request #14561 — Created Aug. 11, 2025 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.1.x

    Reviewers

    We recently re-worked our ReviewRequestPageData to reduce the amount of
    queries we were doing. In that change, we added some processing for diff
    comments where we attach pre-loaded diffsets back to the comments.
    However, we weren't pre-loading the draft diffset of the review request,
    and didn't consider the draft diffset when processing the comments.

    So if a user was viewing a draft review request and they added a draft
    diff comment, this would cause the comment processing to crash on the next
    page load. This change includes the draft diffset in our list of loaded
    diffsets on the ReviewRequestPageData if the draft is accessible by the
    requesting user, allowing the draft diffset to be attached to comments
    during processing.

    • Ran unit tests.
    • Viewed a draft review request that had a draft diffset on it. Created
      a diff comment and hard reloaded the page. Made sure the page didn't
      crash, whereas previously it would crash with a key error in
      diffsets_by_id.
    • Viewed a review request that has a draft as an anonymous user. Made
      sure that I couldn't see the draft, and couldn't see any draft diff
      comments.
    • Created a draft review request that had a draft diffset and draft
      comment on it. Viewed the draft review requets as a superuser/admin
      that does not own the draft comment/review, made sure that the admin
      could not see the draft diff comment or review.

    Commits

    Files