]> source.dussan.org Git - redmine.git/commitdiff
Don't duplicate users in Issue#assignable_users. From r4240
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 7 Oct 2010 17:46:37 +0000 (17:46 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 7 Oct 2010 17:46:37 +0000 (17:46 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4241 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
test/unit/issue_test.rb

index 6856355ccb311f5e53985cc86ac32cb3b463ef4e..3fbbb451307a0360b35097bc48bbca78178cb476 100644 (file)
@@ -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
index efaaafbbda546a92d17858b7397f39fcc1de804c..4438d854d2fd31b986ddb713e600d55863d5b945 100644 (file)
@@ -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