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 2

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

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.
bf4481c4c5909a1308757c840cc173ead17c30ee David Trowbridge
reviewboard/attachments/managers.py
reviewboard/attachments/tests.py
reviewboard/diffviewer/models/filediff.py
reviewboard/webapi/tests/test_diff_file_attachment.py
Loading...