post-review and webapi: Allow specifying a submitter different that the currently logged user

Review Request #244 — Created Feb. 12, 2008 and submitted

Information

Review Board SVN (deprecated)
405

Reviewers

This is very useful for post-commit hooks, where the "currently logged user" will be one with the right permissions to specify the changeset committer as the review request submitter.

It is based on http://reviews.review-board.org/r/210/, but I left out everything not strictly needed for this use case (except a few imports missing on json.py). Also used django permission system.

Update 2008-02-14: Changes according to Christian's review, diff against current HEAD.

Update 2008-02-14 (Again): is_mutable_by is now used on reviews.views.publish (otherwise the -p flag of post-review will not work) and reviews.views.setstatus (for consistency). Also actually made a change I unintentionally ignored before and adjusted a line to respect the 80 characters limit.

 
chipx86
  1. Thanks for doing this.
    
    Just a few small changes and it's ready to go.
  2. /trunk/reviewboard/contrib/tools/post-review (Diff revision 1)
     
     
     
     
    Missing a trailing period.
  3. Blank line before this.
    1. OK. Is there a coding-style guide? (I do not know if I was dreaming, but I am pretty sure I saw such document. But I am unable to find it now)
    2. There's not, but we should really write one now that there's so many people contributing.
  4. "logged in user"
  5. Instead of defining submit_as above, we can probably just use options.submit_as here.
  6. /trunk/reviewboard/reviews/models.py (Diff revision 1)
     
     
    I'm thinking we should rename this to is_accessible_by or is_viewable_by. is_visible_to seems to suggest I would see this in my dashboard, which I certainly wouldn't want, being an admin on the VMware Review Board :)
    1. OK, I am choosing is_accessible_by, because is_viewable_by may end suggesting the same that is_visible_to.
  7. /trunk/reviewboard/webapi/json.py (Diff revision 1)
     
     
     
     
     
    The blank line should remain.
  8. 
      
chipx86
  1. Excellent. Thanks for doing this. Committed to SVN.
  2.