In Base(1): Review UI URLs, Review UIs are getting the ability to define custom URLs for internal use, like re-rendering content or calculating data for dynamic display.
This task builds upon that by adding a standard
_render/ URL for
TextBasedReviewUI. This would ultimately take a
type= argument specifying (
rendered), which could be passed by the caller. We may even want to be able to let review UIs handle other types as well, but that's not a requirement for now.
TextBasedReviewUI should provide a view for this URL that does the following:
Security is important, and we don't want to duplicate effort. So instead of repeating logic, we can have the view make use of
reviewboard/reviews/views.py) to get the correct security and review request lookup logic by default. See how
ReviewFileAttachmentView makes use of this.
ReviewFileAttachmentView also has some complex lookups (for
file_attachment_diff_id) that we don't want to duplicate, so we should pull some of that into utility methods in a new
ReviewFileAttachmentViewMixin. Then, both
ReviewFileAttachmentView and our own views can look up file attachments and diffed file attachments in exactly the same way, keeping both simple.
It'll be important to write unit tests for this. They must cover:
TextBasedReviewUIthat handles different render options, make calls with those options, compare the results.