Move functionality from FileAttachmentReviewUI into base ReviewUI.

Review Request #13525 — Created Feb. 6, 2024 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

In order to make Review UI classes more flexible, we're going to
consolidate all the functionality down into the base class. We currently
had the ReviewUI class which has an opaque obj member, and the
FileAttachmentReviewUI class which assumes that self.obj is a
FileAttachment. This change takes the functionality from
FileAttachmentReviewUI and moves it into the base class,
conditionalizing it based on the type of self.obj. This will allow us
to add additional conditions for other types of objects, such as
allowing it to be a FileDiff.

This also adds a new flag to the ReviewUI classes for whether they
support operating on a FileAttachment. This is used when selecting the
best ReviewUI for a given object.

  • Ran unit tests.
  • Tested to make sure Review UIs for common file types (images,
    markdown) still worked correctly.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Move functionality from FileAttachmentReviewUI into base ReviewUI.
In order to make Review UI classes more flexible, we're going to consolidate all the functionality down into the base class. We currently had the `ReviewUI` class which has an opaque `obj` member, and the `FileAttachmentReviewUI` class which assumes that `self.obj` is a `FileAttachment`. This change takes the functionality from `FileAttachmentReviewUI` and moves it into the base class, conditionalizing it based on the type of `self.obj`. This will allow us to add additional conditions for other types of objects, such as allowing it to be a `FileDiff`. This also adds a new flag to the ReviewUI classes for whether they support operating on a `FileAttachment`. This is used when selecting the best ReviewUI for a given object. Testing Done: - Ran unit tests. - Tested to make sure Review UIs for common file types (images, markdown) still worked correctly.
39f014dad0dde611d23886aaa48467f89482e558 David Trowbridge
docs/manual/extending/extensions/review-ui.rst
reviewboard/attachments/models.py
reviewboard/extensions/hooks/review_ui.py
reviewboard/reviews/builtin_fields.py
reviewboard/reviews/models/file_attachment_comment.py
reviewboard/reviews/tests/test_file_attachment_review_ui.py
reviewboard/reviews/tests/test_review_ui.py
reviewboard/reviews/ui/base.py
reviewboard/reviews/ui/image.py
reviewboard/reviews/ui/screenshot.py
reviewboard/reviews/ui/text.py
reviewboard/reviews/views/attachments.py
Loading...