Properly handle draft and inactive screenshots/file attachments.
Review Request #3250 — Created July 30, 2012 and submitted
Properly handle draft and inactive screenshots/file attachments. The recent optimizations caused a regression for screenshots and file attachments where any draft entries wouldn't be shown for the user after uploading until the review request was published. This was due to querying the review request and not the draft for these. There was also a performance issue where inactive screenshots/file attachments weren't being cached, causing a lookup per comment referencing an inactive one. Now we cache these, but only when we encounter a case where we need them. Unit tests were added to cover these cases.
Unit tests didn't pass before (showing that the draft entries were missing when the owner viewed the page). Now they do pass. I inspected the SQL queries for the cases these all cover. I verified we only build the inactive maps when we need them, and no longer fetch each item individually.