Actions
Defect #16038
closedIssue#css_classes corrupts user.groups association cache
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
https://github.com/redmine/redmine/pull/27
diff --git a/app/models/issue.rb b/app/models/issue.rb
index debb931..b9a2b20 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1091,7 +1091,7 @@ def css_classes(user=User.current)
if user.logged?
s << ' created-by-me' if author_id == user.id
s << ' assigned-to-me' if assigned_to_id == user.id
- s << ' assigned-to-my-group' if user.groups.any? {|g| g.id = assigned_to_id}
+ s << ' assigned-to-my-group' if user.groups.any? {|g| g.id == assigned_to_id}
end
s
end
If user belongs any groups, 'assigned-to-my-group' is set.
It is wrong.
Related issues
Updated by Toshi MARUYAMA almost 11 years ago
- Related to Defect #12681: Treat group assignments as assigned to me added
Updated by Toshi MARUYAMA almost 11 years ago
It has serious side effect.
1.9.3p484 :002 > user = Group.find(10).users.first 1.9.3p484 :004 > user.groups.collect(&:id) Group Load (1.0ms) SELECT "users".* FROM "users" INNER JOIN "groups_users" ON "users"."id" = "groups_users"."group_id" WHERE "users"."type" IN ('Group') AND "groups_users"."user_id" = 8 => [10, 11] 1.9.3p484 :005 > assigned_to_id = 1 => 1 1.9.3p484 :006 > user.groups.any? {|g| g.id == assigned_to_id} => false 1.9.3p484 :007 > user.groups.any? {|g| g.id = assigned_to_id} => true 1.9.3p484 :008 > user.groups.collect(&:id) => [1, 11]
Updated by Toshi MARUYAMA almost 11 years ago
But, it seems no effect on database.
1.9.3p484 :011 > user.save! (0.3ms) begin transaction (0.2ms) commit transaction => true 1.9.3p484 :012 > user.groups.collect(&:id) => [1, 11] 1.9.3p484 :013 > user.reload User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."type" IN ('User', 'AnonymousUser') AND "users"."id" = ? LIMIT 1 [["id", 8]] => #<User id: 8, login: "miscuser8", hashed_password: "8f659c8d7c072f189374edacfa90d6abbc26d8ed", firstname: "User", lastname: "Misc", mail: "miscuser8@foo.bar", admin: false, status: 1, last_login_on: nil, language: "it", auth_source_id: nil, created_on: "2006-07-19 17:33:19", updated_on: "2006-07-19 17:33:19", type: "User", identity_url: nil, mail_notification: "only_my_events", salt: "7599f9963ec07b5a3b55b354407120c0", must_change_passwd: false> 1.9.3p484 :014 > user.groups.collect(&:id) Group Load (0.5ms) SELECT "users".* FROM "users" INNER JOIN "groups_users" ON "users"."id" = "groups_users"."group_id" WHERE "users"."type" IN ('Group') AND "groups_users"."user_id" = 8 => [10, 11]
Updated by Jean-Philippe Lang almost 11 years ago
- Is duplicate of Patch #16002: Assigned-to-my-group css corrupts user.groups association cache added
Updated by Jean-Philippe Lang almost 11 years ago
- Subject changed from Issue 'assigned-to-my-group' css class is wrong to Issue#css_classes corrupts user.groups association cache
- Category changed from UI to Code cleanup/refactoring
- Status changed from New to Closed
- Private changed from Yes to No
- Resolution set to Fixed
Updated by Jean-Philippe Lang almost 11 years ago
- Related to Defect #16166: Incorrect data on Issues assigned to me on MyPage added
Actions