summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/issues_controller.rb1
-rw-r--r--test/functional/issues_controller_test.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 29fc0c9f3..fa911a11b 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -415,6 +415,7 @@ class IssuesController < ApplicationController
@copy_attachments = params[:copy_attachments].present? || request.get?
@copy_subtasks = params[:copy_subtasks].present? || request.get?
@issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy)
+ @issue.parent_issue_id = @copy_from.parent_id
rescue ActiveRecord::RecordNotFound
render_404
return
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 8cbd99d64..395a5615e 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2775,6 +2775,14 @@ class IssuesControllerTest < ActionController::TestCase
assert_select 'input[name=copy_attachments]', 0
end
+ def test_new_as_copy_should_preserve_parent_id
+ @request.session[:user_id] = 2
+ issue = Issue.generate!(:parent_issue_id => 2)
+ get :new, :project_id => 1, :copy_from => issue.id
+
+ assert_select 'input[name=?][value="2"]', 'issue[parent_issue_id]'
+ end
+
def test_new_as_copy_with_subtasks_should_show_copy_subtasks_checkbox
@request.session[:user_id] = 2
issue = Issue.generate_with_descendants!