• 
      

    Fix diff attachment and default reviewers for post-commit review.

    Review Request #8539 — Created Nov. 15, 2016 and submitted — Latest diff uploaded

    Information

    Review Board
    release-2.5.x
    b4dccff...

    Reviewers

    We had a very, very old bug with post-commit review where the diffs from
    the posted commit would be attached to the Review Request's diffset
    history, rather than the draft. This made the diff accessible to
    superusers who had access to the review request, which wasn't a big
    deal, but more importantly it meant the diff wasn't accessible via the
    draft API and default reviewers would not apply.
    
    This change fixes this by redoing some of that logic. Formerly, the code
    for updating was assuming it would be called on either the draft or
    review request, but in practice now it's only ever called on the draft,
    so that has moved into ReviewRequestDraft and has been updated to
    associate there instead of the review request history.
    
    That also required some new code that figured out a suitable revision
    for the diffset. Since that's already been done in two other places, the
    logic has been centralized (and optimized to reduce the data returned
    from an SQL query).
    
    Some unit tests were added and others moved around to test against the
    draft instead of review request.

    Unit tests pass.

    Tested post-commit review with default reviewers. It worked.