Fix Files header still appearing after all attachments are removed.

Review Request #8417 — Created Sept. 19, 2016 and submitted — Latest diff uploaded

Information

Review Board
release-2.5.x
2e11cfb...

Reviewers

The review page still showed the "Files" header when all attachments were
removed and the page was not reloaded. This was because the visibility of
the header was determined by the template once on page load, but the
attachments removed themselves dynamically from the page.

We now listen to "attachment remove" events, and dynamically hide the header
as necessary. Note that it wasn't necessary to check if the header should be
re-shown if an attachment was added because it either
a) triggers a full-page reload (Update > Add File) or
b) Automatically reshows the Files section (drag-and-drop).

  • Created a new review request and added (multiple) files to it.
  • Deleted some of the files and confirmed deleting still works as before.
  • When there was only one attachment left, removed it and confirmed the
    "Files" header was also removed.
  • Uploaded another file attachment (now that there is no files/header)
    using both drag-and-drop and Update > Add File and confirmed Files header
    (and the file) reappears.
  • Repeated testing on a published review request.