Fix the Review.objects._query method when querying the current user.

Review Request #9411 — Created Nov. 30, 2017 and submitted

Information

Review Board
release-2.5.x
e77b6ff...

Reviewers

The query returned by Review.objects.from_user() was behaving
strangely when called with the currently logged-in user, because it was
OR-ing in an additional query on top of the ones that are already done
(so that it additionally included reviews that were replies). This is
not what people expect from this query, which is used only in the
"Reviews" list on the user page and in a couple extensions.

Ran unit tests.

Description From Last Updated

F821 undefined name 'include_own'

reviewbotreviewbot
david
Review request changed
Summary:
Fix the Review.objects.from_user query for "third party" views.
Fix the Review.objects._query method when querying the current user.
Description:
   

The query returned by Review.objects.from_user() was behaving

    strangely when called with the currently logged-in user, because it was
    OR-ing in an additional query on top of the ones that are already done
~   (so that it additionally included reviews that were replies or drafts).
~   This is rarely what people expect from this query, which is used only in
~   the "Reviews" list on the user page and in a couple extensions.

  ~ (so that it additionally included reviews that were replies). This is
  ~ not what people expect from this query, which is used only in the
  ~ "Reviews" list on the user page and in a couple extensions.

-  
-  

This change adds an extra parameter to _query to preserve the existing

-   behavior, but then makes sure that calls to from_user return what's
-   more likely to be expected.

Commit:
84acfbb9c6d4b5e9079794cb60309803567aa4f3
bd5e89a3312ae9eefc2c987764f3d12e3b7810e4

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
MU
  1. 
      
  2. reviewboard/reviews/managers.py (Diff revision 3)
     
     

    I did my docstring for "all_my_reviews" differently, but I will change it to look similar to this.

  3. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (c976fb4)