OSDN Git Service

Fixed: copying an issue keeps the author of the original issue (#6901).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 29 Apr 2011 12:41:07 +0000 (12:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 29 Apr 2011 12:41:07 +0000 (12:41 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5601 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 07966d4..47492da 100644 (file)
@@ -175,6 +175,7 @@ class Issue < ActiveRecord::Base
       issue.reset_custom_values!
     end
     if options[:copy]
+      issue.author = User.current
       issue.custom_field_values = self.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
       issue.status = if options[:attributes] && options[:attributes][:status_id]
                        IssueStatus.find_by_id(options[:attributes][:status_id])
index 25f664a..ecd7b1f 100644 (file)
@@ -545,6 +545,13 @@ class IssueTest < ActiveSupport::TestCase
 
         assert_equal date, @copy.due_date
       end
+      
+      should "set current user as author" do
+        User.current = User.find(9)
+        @copy = @issue.move_to_project(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {}})
+
+        assert_equal User.current, @copy.author
+      end
     end
   end