Fix the Review.objects._query method when querying the current user.
Review Request #9411 — Created Nov. 30, 2017 and submitted
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' |
reviewbot |
- 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 behavingstrangely 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:
-
84acfbb9c6d4b5e9079794cb60309803567aa4f3bd5e89a3312ae9eefc2c987764f3d12e3b7810e4
- Diff:
-
Revision 2 (+47 -8)
Checks run (1 failed, 1 succeeded)
flake8
failed.
JSHint
passed.
flake8
- Commit:
-
bd5e89a3312ae9eefc2c987764f3d12e3b7810e4e77b6ff9accf27c1e11b80c75b90a96cb06f681c
- Diff:
-
Revision 3 (+42 -7)
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.