Bug fix: Update comment issue status on a deleted screenshot

Review Request #3053 — Created April 9, 2012 and submitted

Information

Review Board

Reviewers

This fixes a bug where an issue on a deleted screenshot can not have its status updated.

A possible fix has been proposed, confirmation is required. A test case to expose this scenario has also been created.

This bug may also be present with file attachments.
Ran reviewboard.webapi.tests:ReviewScreenshotCommentResourceTests.

11 Tests OK
Description From Last Updated

Seems like this would end up causing all comments to be returned, not just for this review request? Instead, I …

chipx86chipx86

Should be _delete_screenshot. (Yeah, the other functions need changing, but we'll do that at some point.)

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/webapi/resources.py (Diff revision 1)
     
     
    Show all issues
    Seems like this would end up causing all comments to be returned, not just for this review request?
    
    Instead, I think you can do a Q(screenshot__review_request=) | Q(screenshot__inactive_review_request=)
    1. I'm not sure how to plug in those queries.
      
      return self.model.objects.filter(screenshot__review_request=) || self.model.objects.filter(screenshot__inactive_review_request=)
      
      Would that be correct?
    2. I think he means this:
      
      return self.model.objects.filter(Q(screenshot__review_request=review_request) ||
                                       Q(screenshot__inactive_review_request=review_request),
                                       review__isnull=False)
    3. Except | instead of ||
    4. Thanks David, Christian.
  3. reviewboard/webapi/tests.py (Diff revision 1)
     
     
    Show all issues
    Should be _delete_screenshot.
    
    (Yeah, the other functions need changing, but we'll do that at some point.)
  4. 
      
ME
chipx86
  1. Ship It!
  2. 
      
ME
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.6.x (4db1e57)