Fix several issues with draft diffs

Review Request #288 — Created March 4, 2008 and submitted — Latest diff uploaded

chipx86
Review Board SVN (deprecated)
trunk
323
reviewboard
We had several issues with draft diffs.

1) They were automatically placed in the diffset history of a review request, making them publicly accessible. This meant they were not destroyed when destroying a draft. I'm unsure as to how long this has been broken.
2) The queries for grabbing a draft diff didn't take into account the user accessing the review request.
3) The diff viewer didn't really let you know you were looking at a draft diff, and didn't work when #1 was fixed.

We now keep diffs out of a review request's diffset history when creating them, and we assign them an appropriate revision number. We only check for the draft diffs if the requesting user is logged in and owns the review request. We also modify the diff viewer a bit to tell the user when they're looking at a draft diff.

This fixes bug 323, and should also fix bugs regarding revision numbers being skipped and default reviewers not being set (since that check queried if any diffsets existed for the review request, which they did due to #1 above).
All my manual tests showed that the correct things were being seen for a logged in user accessing a draft diff, and that other users and non-logged in users couldn't see it.

Verified that interdiffs work with the draft diffs and that discarding a draft deletes the diffset.

All unit tests pass (with a tweak to fix broken behavior).
Loading...