]> source.dussan.org Git - redmine.git/commitdiff
Allow assigning issues back to the author. #4199
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 7 Oct 2010 17:28:29 +0000 (17:28 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 7 Oct 2010 17:28:29 +0000 (17:28 +0000)
This allows an issue to be reassigned to the author even if they are not
a project member.  Useful when passing back an issue to get more
information from the author.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4240 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 44b4ba80ba980a4121234a3faef4160e416534c3..6856355ccb311f5e53985cc86ac32cb3b463ef4e 100644 (file)
@@ -390,7 +390,9 @@ class Issue < ActiveRecord::Base
   
   # Users the issue can be assigned to
   def assignable_users
-    project.assignable_users
+    users = project.assignable_users
+    users << author if author
+    users.sort
   end
   
   # Versions that the issue can be assigned to
index 13a24cd6901a61cd71b7587495066dfb2b2a8dd6..efaaafbbda546a92d17858b7397f39fcc1de804c 100644 (file)
@@ -532,9 +532,19 @@ class IssueTest < ActiveSupport::TestCase
       assert Issue.new(:start_date => 100.days.ago.to_date, :due_date => Date.today, :done_ratio => 90).behind_schedule?
     end
   end
-  
-  def test_assignable_users
-    assert_kind_of User, Issue.find(1).assignable_users.first
+
+  context "#assignable_users" do
+    should "be Users" do
+      assert_kind_of User, Issue.find(1).assignable_users.first
+    end
+
+    should "include the issue author" do
+      project = Project.find(1)
+      non_project_member = User.generate!
+      issue = Issue.generate_for_project!(project, :author => non_project_member)
+
+      assert issue.assignable_users.include?(non_project_member)
+    end
   end
   
   def test_create_should_send_email_notification