Improve how we display and manage file attachment states.

Review Request #13240 — Created Aug. 31, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-6.x

Reviewers

There are several improvements that can be made to the way that we display and
manage file attachments. Currently, when looking at a review request draft we
have no way of knowing whether a file attachment is a draft or not. It would
be nice to be able to distinguish the draft file attachments from the published
ones. It would also be nice to be able to see if a draft is a new revision of
an attachment, a completely new one, or an update to an existing one (e.g. one
with an updated caption). We also can't tell when a file attachment is
pending deletion on a review request draft, i.e. when its been deleted from
the draft but the draft has not been published yet.

This change aims to address all of those issues. Now, we use a label to display
the state of file attachments on a review request draft (except for published
attachments). It's easier to undo draft updates to the attachments with a
new "Delete Draft" action, which can delete draft revisions and redisplay
the previously published attachment, delete new drafts, or undo any changes
to the caption. And, instead of making attachments disappear after deleting
them from a review request draft, we display them as pending deletion and
allow users to undo the deletion with an "Undo Delete" action.

  • Ran unit tests.
  • Ran JS unit tests.
  • Lots of manual testing, uploading/updating/deleting file attachments,
    changing the state, changing the caption, updating, reviewing, commenting,
    testing the new actions.
  • Made sure user file attachments and file attachments thumbnails in change
    descriptions were not affected.
  • Tested trying to view a draft review request as a user who doesn't have
    permission for the draft, saw that no file attachment states or any of
    the new actions appeared.

Commits

Files