Fixed: copying an issue keeps the author of the original issue (#6901).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5601 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-04-29 12:41:07 +00:00
parent c9f31f0332
commit 88a93d7e10
2 changed files with 8 additions and 0 deletions

View 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])

View 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