fix wrong issue 'assigned-to-my-group' css class (#16038)

git-svn-id: http://svn.redmine.org/redmine/trunk@12844 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-06 12:16:27 +00:00
parent 3817f1e304
commit a0baf7ee5d
2 changed files with 14 additions and 11 deletions

View File

@ -1091,7 +1091,7 @@ class Issue < ActiveRecord::Base
if user.logged? if user.logged?
s << ' created-by-me' if author_id == user.id s << ' created-by-me' if author_id == user.id
s << ' assigned-to-me' if assigned_to_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 end
s s
end end

View File

@ -2254,16 +2254,19 @@ class IssueTest < ActiveSupport::TestCase
assert_include 'priority-highest', classes assert_include 'priority-highest', classes
end end
def test_css_classes_should_include_user_assignment def test_css_classes_should_include_user_and_group_assignment
issue = Issue.generate(:assigned_to_id => 2) project = Project.first
assert_include 'assigned-to-me', issue.css_classes(User.find(2)) user = User.generate!
assert_not_include 'assigned-to-me', issue.css_classes(User.find(3)) group = Group.generate!
end Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
group.users << user
def test_css_classes_should_include_user_group_assignment assert user.member_of?(project)
issue = Issue.generate(:assigned_to_id => 10) issue1 = Issue.generate(:assigned_to_id => group.id)
assert_include 'assigned-to-my-group', issue.css_classes(Group.find(10).users.first) assert_include 'assigned-to-my-group', issue1.css_classes(user)
assert_not_include 'assigned-to-my-group', issue.css_classes(User.find(3)) assert_not_include 'assigned-to-me', issue1.css_classes(user)
issue2 = Issue.generate(:assigned_to_id => user.id)
assert_not_include 'assigned-to-my-group', issue2.css_classes(user)
assert_include 'assigned-to-me', issue2.css_classes(user)
end end
def test_save_attachments_with_hash_should_save_attachments_in_keys_order def test_save_attachments_with_hash_should_save_attachments_in_keys_order