Update FileAttachment.objects.create_from_filediff to set needed fields.

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

Information

Review Board
master

Reviewers

It turns out that having a FileAttachment for a diff that does not have
the review request set will cause the review UI instantiation to fail.
This change fixes the create_from_filediff method to set the review
request and local site fields correctly based on the given FileDiff's
review request.

  • Ran unit tests.
  • Used this when automatically creating a diff file attachment in a
    later change.

Diff Revision 3 (Latest)

orig
1
2
3

Commits

First Last Summary ID Author
Update FileAttachment.objects.create_from_filediff to set needed fields.
It turns out that having a FileAttachment for a diff that does not have the review request set will cause the review UI instantiation to fail. This change fixes the `create_from_filediff` method to set the review request and local site fields correctly based on the given FileDiff's review request. Testing Done: - Ran unit tests. - Used this when automatically creating a diff file attachment in a later change. Reviewed at https://reviews.reviewboard.org/r/13532/
03af6a5de80fa01c8dce9b878cb73e6cb6b5b899 David Trowbridge
reviewboard/attachments/managers.py
reviewboard/attachments/tests.py
reviewboard/diffviewer/models/filediff.py
reviewboard/webapi/tests/test_diff_file_attachment.py
Loading...