Fix updating file attachments.

Review Request #10704 — Created Sept. 7, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

The "Update" functionality for file attachments was broken in several
ways. The most basic of these was an error that got introduced sometime
whereby we weren't plumbing the review request editor through into the
upload dialog, and so it couldn't create the new file attachment object.
This was an easy fix, but exposed other issues.

We used to reload the entire page after creating a new file attachment.
This was changed to send the form data via javascript, but that meant we
no longer reloaded the page, and so the new file attachment would be
appended to the list of file attachments and show up as a new one at the
end of the list, rather than replacing the old revision. I've fixed up
the review request editor to correctly manage its collection of file
attachment objects, and the editor view to add new file attachments at
the correct index (and remove thumbnails as they're removed from the
collection).

  • Updated various file attachments. Saw that drafts were created
    correctly and that the thumbnail at the correct index was reloaded.
  • Ran unit tests.

Commits

Files