Comments
-
Greg Hurrell
Thanks a lot for the report. Wouldn't have noticed myself as it works for me when logged in (admin account), and also when not logged in; when I log in on a normal account I can reproduce it.
-
Greg Hurrell
I notice the same thing happens using the issue search and selecting a product from the pop-up.
Works for admin account and anonymous visitor, but doesn't work for logged-in normal accounts.
Not just on product field either; exactly the same behavior for the status and the kind pop-ups as well.
-
Greg Hurrell
Ok, think I've found the cause of the bug. It's an operator precedence thing.
The
SELECT
query that gets built up for admin users ends up including:awaiting_moderation = FALSE
And for anonymous users it ends up being:
awaiting_moderation = FALSE AND public = TRUE
While for logged-in, normal users it ends up being:
awaiting_moderation = FALSE AND public = TRUE OR user_id = 20
As
AND
has higher precedence thanOR
, that's equivalent to:(awaiting_moderation = FALSE AND public = TRUE) OR user_id = 20
When it really should be forced to be the opposite via parentheses:
awaiting_moderation = FALSE AND (public = TRUE OR user_id = 20)
That's my hunch, anyway, going to see if I can whip up some failing tests, try out the fix, and see if that makes the tests pass.
I'm in the middle of some rather invasive changes right now (trying out Rails 3), thank goodness Git makes this kind of thing easy (
git stash
,git rebase
etc). -
Greg Hurrell
Ok, finally got the Rails 3 stuff under the control (it was painful) to the point where I can look at other bugs. This one is now fixed in the
rails3
branch, so will get deployed after a lot of testing... (most likely won't deploy a Rails 3 version of the site until Rails 3.0.1 or 3.0.2 has been out in the field for a while). -
Greg Hurrell
Status changed:
- From: new
- To: closed
Add a comment
Comments are now closed for this issue.