From 73f12765a99b6d78c5d23a58fe887c79a4012e99 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 7 Oct 2010 17:46:37 +0000 Subject: [PATCH] Don't duplicate users in Issue#assignable_users. From r4240 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4241 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 2 +- test/unit/issue_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 6856355cc..3fbbb4513 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -392,7 +392,7 @@ class Issue < ActiveRecord::Base def assignable_users users = project.assignable_users users << author if author - users.sort + users.uniq.sort end # Versions that the issue can be assigned to diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index efaaafbbd..4438d854d 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -545,6 +545,15 @@ class IssueTest < ActiveSupport::TestCase assert issue.assignable_users.include?(non_project_member) end + + should "not show the issue author twice" do + assignable_user_ids = Issue.find(1).assignable_users.collect(&:id) + assert_equal 2, assignable_user_ids.length + + assignable_user_ids.each do |user_id| + assert_equal 1, assignable_user_ids.count(user_id), "User #{user_id} appears more or less than once" + end + end end def test_create_should_send_email_notification