summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb10
-rw-r--r--app/models/project.rb2
2 files changed, 5 insertions, 7 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 6141780a5..d7ef5eded 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -265,9 +265,11 @@ class Issue < ActiveRecord::Base
# Copies attributes from another issue, arg can be an id or an Issue
def copy_from(arg, options={})
issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
- self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "closed_on")
+ self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "status_id", "closed_on")
self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
- self.status = issue.status
+ if options[:keep_status]
+ self.status = issue.status
+ end
self.author = User.current
unless options[:attachments] == false
self.attachments = issue.attachments.map do |attachement|
@@ -973,10 +975,6 @@ class Issue < ActiveRecord::Base
statuses << initial_status unless statuses.empty?
statuses << default_status if include_default || (new_record? && statuses.empty?)
- if new_record? && @copied_from
- statuses << @copied_from.status
- end
-
statuses = statuses.compact.uniq.sort
if blocked? || descendants.open.any?
# cannot close a blocked issue or a parent with open subtasks
diff --git a/app/models/project.rb b/app/models/project.rb
index 942affe11..3d8878ca2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -952,7 +952,7 @@ class Project < ActiveRecord::Base
# get copied before their children
project.issues.reorder('root_id, lft').each do |issue|
new_issue = Issue.new
- new_issue.copy_from(issue, :subtasks => false, :link => false)
+ new_issue.copy_from(issue, :subtasks => false, :link => false, :keep_status => true)
new_issue.project = self
# Changing project resets the custom field values
# TODO: handle this in Issue#project=