Fix a bug with drafts in diff-context API

Review Request #10363 — Created Dec. 19, 2018 and submitted — Latest diff uploaded

solarmist
Review Board
release-3.0.x
bbc10eb...
reviewboard
If the submitter has a draft published and user b is given permission to view that
draft they are unable to view that draft via the diff-context using revisions and
interdiff-revisions.
i.e. aapi/review-requests/1515686/diff-context/?interdiff-revision=2&revision=1

If User2 has a review_request {rr_id} and it has 1 published diff and 1 draft diff and User1 has permission to view drafts then:

curl --cookie "rbsessionid={cookie_user1}" "https://{rb-site}/api/review-requests/{rr_id}/draft/diffs/2/"
curl --cookie "rbsessionid={cookie_user2}" "https://{rb-site}/api/review-requests/{rr_id}/draft/diffs/2/"

Both returns the diff, but

curl --cookie "rbsessionid={cookie_user1}" "https://{rb-site}/api/review-requests/{rr_id}/diff-context/?interdiff-revision=2&revision=1"
curl --cookie "rbsessionid={cookie_user2}" "https://{rb-site}/api/review-requests/{rr_id}/diff-context/?interdiff-revision=2&revision=1"

Only returns the diff for User2 and returns

{
  "stat": "fail",
  "err": {
    "msg": "Object does not exist",
    "code": 100
  }
}
Loading...