Fix a bug where server/local site admins couldn't edit draft attachments.

Review Request #8388 — Created Sept. 8, 2016 and submitted

Information

Review Board
release-2.5.x
7e2bab1...

Reviewers

We had a check in the base file attachment resource for determining
whether draft file attachments should be considered when presenting
results to a requesting user. This performed a direct comparison against
the user, checking if it's the same user who owns the review request.
This differs from other resources that check if the review request is
mutable by the user.

The result was that an admin could upload file attachments to a review
request, but could not edit their captions after the fact.

This changes the logic to check for mutability, fixing edits on draft
file attachments.

It's still not recommended that admins upload file attachments to
another user's review request, and they still won't see a draft banner
if they don't own the review request, but this at least solves the
consistency and expectations problems.

Before the fix, these unit tests failed, reproducing the customer
problem. After the fix, the unit tests passed.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/base_file_attachment.py
        reviewboard/webapi/tests/test_file_attachment_draft.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/base_file_attachment.py
        reviewboard/webapi/tests/test_file_attachment_draft.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (15ab936)