Modify a draft when using update_from_changenum

Review Request #213 — Created Jan. 26, 2008 and submitted

Information

Review Board SVN (deprecated)
trunk
326

Reviewers

Our code for updating a review request by changenum through the API was still operating on the review request and not the draft. This meant that a subsequent call to post-review would touch the underlying review request that everyone saw, but not the draft that the user was modifying. Now we update the draft.
Tested this by creating a review request with a changenum. Saw that the initial review request creation still worked and the changeset info was still being pulled. I then updated the content and ran post-review again. The draft content had changed to match.
david
  1. 
      
  2. /trunk/reviewboard/reviews/models.py (Diff revision 1)
     
     
    It seems like we're collecting these sorts of functions (either as separate utility functions or duplicated code).  Maybe we should put them all in one place at some point?
    1. Yeah, I wasn't thrilled with it. Another option is just to keep this in the draft and instead of populating the initial review request based on the changenum, auto-create the draft and populate that. We really create one anyway but through the uploaded diff.
  3. /trunk/reviewboard/webapi/json.py (Diff revision 1)
     
     
     
     
    Where do we handle the review-request status if it's discarded?
    1. With the draft banners how they are now, they will click "Reopen for Review" on that page, which will set the status appropriately. This isn't really the correct place for it.
      
      We could put this code in ReviewRequestDraft.save_draft(), though.
    2. Seems to me if someone runs post-review on a changeset which has previously been discarded, it should replace the data and make in pending+private.  Maybe that should be a separate API function.
    3. I'll bring this back to what we had for now. We can revisit it later.
  4. 
      
david
  1. Looks great.
  2.