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

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

David Trowbridge
Review Board
release-2.5.x
e77b6ff...
reviewboard

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.

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
David Trowbridge
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

Diff:

Revision 2 (+47 -8)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

David Trowbridge
Mukhtar Alhejji
  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. 
      
Christian Hammond
  1. Ship It!
  2. 
      
David Trowbridge
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (c976fb4)
Loading...