Introduce new file attachment and screenshot counters for review requests.
Review Request #9242 — Created Oct. 3, 2017 and submitted — Latest diff uploaded
When viewing or publishing review requests, we perform a series of
lookups on the file attachments and screenshots (active and inactive) on
the review request and on the draft. This can be up to 8 queries that
we don't really want in most cases (screenshots are never used anymore,
but remain supported for old review requests), but we had no good way of
choosing whether to perform queries for them.
ReviewRequest
andReviewRequestDraft
now have new
RelationCounterFields
that track how many active and inactive file
attachments and screenshots there are. This allows code to simply check
the populated counters instead of performing a series of queries,
improving performance across the product and all but guaranteeing that
we won't look up screenshots anymore.
Unit tests pass.
Checked existing drafts and review requests and saw that the counters
were populated to the correct values.Created a new draft and saw that it had the correct counters from the
review request.Uploaded new file attachments and saw that the draft's counters were
updated correctly.Deleted a file attachment and saw that the draft's counters were updated
correctly.Published the draft. Saw that the review request's counters were updated
correctly.