• 
      

    Allow status updates to be manually run by the review request owner.

    Review Request #14445 — Created May 20, 2025 and submitted

    Information

    Review Board
    release-7.1.x

    Reviewers

    Status updates can be manually run by clicking a "Run" button in the
    status update entry on the review request. Review request owners should
    be able to click this, but we have a bug where only admins or the owner of
    the status update (aka the configured the Review Bot user) can click the
    button to trigger a run. This change fixes that by allowing the review
    request owner to pass the mutability check for status updates on the
    review request.

    This change also hides the "Run" button from users who do not have
    mutability permissions for the status update.

    Unit tests were added for these cases. We also set data on the
    StatusUpdatesEntryMixin object and the review_request on the
    StatusUpdate in unit tests, which are always set in practice but
    weren't needed in our unit tests before this change.

    • Ran unit tests.
    • Ran a manual status update as the review request owner.
    • Ran an automatic status update.
    • Confirmed that the run button didn't appear for non-owners and
      non-admins.
    • Ran multiple status updates for one review request, one manual and
      one automatic.
    • Tested updating a review request and seeing the status updates run
      again.
    Summary ID
    Allow status updates to be manually run by the review request owner.
    Status updates can be manually run by clicking a "Run" button in the status update entry on the review request. Review request owners should be able to click this, but we have a bug where only admins or the owner of the status update (aka the configured the Review Bot user) can click the button to trigger a run. This change fixes that by allowing the review request owner to pass the mutability check for status updates on the review request. This change also hides the "Run" button from users who do not have mutability permissions for the status update. Unit tests were added for these cases. We also set `data` on the `StatusUpdatesEntryMixin` object and the `review_request` on the `StatusUpdate` in unit tests, which are always set in practice but weren't needed in our unit tests before this change.
    e79818620fa480c04b485134b6b8337763c1c9f7
    Description From Last Updated

    While you're updating these, mind adding -> None to them?

    daviddavid

    While here, can you add typing that includes User and AnonymousUser? That'll help ensure everything in here is safe.

    chipx86chipx86

    I'd reverse these changes, and also use review_request.submitter_id. The two combined will save on any lookups in the owner case.

    chipx86chipx86

    Can we pull out self.review_request, since we're currently accessing it 21 times?

    chipx86chipx86
    david
    1. 
        
    2. Show all issues

      While you're updating these, mind adding -> None to them?

    3. 
        
    maubin
    david
    1. Ship It!
    2. 
        
    chipx86
    1. 
        
    2. Show all issues

      While here, can you add typing that includes User and AnonymousUser? That'll help ensure everything in here is safe.

    3. reviewboard/reviews/models/status_update.py (Diff revision 2)
       
       
       
       
      Show all issues

      I'd reverse these changes, and also use review_request.submitter_id. The two combined will save on any lookups in the owner case.

    4. Show all issues

      Can we pull out self.review_request, since we're currently accessing it 21 times?

    5. 
        
    maubin
    david
    1. Ship It!
    2. 
        
    chipx86
    1. Ship It!
    2. 
        
    maubin
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.1.x (f387403)