Make sure the last_updated review request draft field is properly set after updating the draft.
Review Request #13260 — Created Sept. 6, 2023 and submitted
We've had a longstanding bug where a review request draft would be updated, but
we would still display old cached data for the draft upon page reloads. While
we rely on the
ReviewRequestDraft.last_updatedfield when generating ETags
for a review request page, this field wasn't being properly updated when a
draft gets updated, so we wouldn't catch that the ETag was stale.
In conjuction with /r/13261, this fixes the caching issue by making sure that
last_updatedfield gets updated whenever a field is modified in a draft,
or when an associated file attachment is created/deleted/updated.
This change also updates some file attachment unit tests to take into account
the one extra query that is being performed when saving the
field on review reuqest drafts.
Tested with the /r/13261 change.
- Ran unit tests.
- Tested updating a review request draft by updating each of the fields,
information (bugs, depends on, etc) and updating file attachments, saw
last_updatedwas updated correctly.
- Tested updating the change description, saw that it didn't update
- Tested manually setting
last_updatedto a value during saving, saw that
value being used instead of
timezone.now()to make sure that we don't
overwrite any manually set values.
- Rebased onto the new file attachment changes that were merged into
- Added the extra query to the appropriate unit tests.
Revision 2 (+262 -54)
Checks run (2 succeeded)