Block commenting on deleted file attachments.

Review Request #13329 — Created Oct. 11, 2023 and submitted — Latest diff uploaded


Review Board


Our current UI allows users to comment on deleted file attachments, but these
comments cannot actually be saved for the deleted files. It also doesn't make
sense to allow commenting on deleted files. To address this, this change blocks
commenting on deleted files. When attempting to comment on one, we display a
warning message in the comment dialog and block the ability to edit the file,
similar to what we display when unauthenticated users try to create comments.
We update the FileAttachmentCommentBlock and FileAttachmentReviewable
models to make use of the file attachment states concept that were recently

This also hides the Markdown docs link for comment dialogs that cannot be
edited. This makes more sense than hiding it only for unauthenticated
users, which is what we were doing before.

  • Ran unit tests and JS tests.
  • Tested commenting on a deleted file, saw the warning and inability to
    edit/save the comment.
  • Tested commenting on a non-deleted file.
  • Tested commenting on a draft file.
  • Tested the above cases while logged in and while not logged in.