From: Go MAEDA
<%= check_box_tag 'copy_attachments', '1', @copy_attachments %> diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index 7532d5d0e..0e978fa6b 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -5,6 +5,8 @@
<%= setting_select :link_copied_issue, link_copied_issue_options %>
+<%= setting_select :copy_attachments_on_issue_copy, copy_attachments_on_issue_copy_options %>
+<%= setting_select :cross_project_subtasks, cross_project_subtasks_options %>
<%= setting_check_box :close_duplicate_issues %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 05e01b77a..7d51ed1b7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -503,6 +503,7 @@ en: setting_force_default_language_for_anonymous: Force default language for anonymous users setting_force_default_language_for_loggedin: Force default language for logged-in users setting_link_copied_issue: Link issues on copy + setting_copy_attachments_on_issue_copy: Copy attachments on copy setting_max_additional_emails: Maximum number of additional email addresses setting_email_domains_allowed: Allowed email domains setting_email_domains_denied: Disallowed email domains diff --git a/config/settings.yml b/config/settings.yml index 346288a4a..19d3a33c7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -190,6 +190,8 @@ parent_issue_done_ratio: default: 'derived' link_copied_issue: default: 'ask' +copy_attachments_on_issue_copy: + default: 'ask' close_duplicate_issues: default: 1 issue_group_assignment: diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 44ad19f22..3b7521d40 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -5624,6 +5624,47 @@ class IssuesControllerTest < Redmine::ControllerTest end end + def test_create_as_copy_should_always_copy_attachments_by_settings + assert_equal 4, Issue.find(3).attachments.size + with_settings :copy_attachments_on_issue_copy => 'yes' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_difference 'Attachment.count', 4 do + post( + :create, + :params => { + :project_id => 1, + :copy_from => 3, + :issue => { + :subject => 'Copy' + } + } + ) + end + end + end + end + + def test_create_as_copy_should_never_copy_attachments_by_settings + with_settings :copy_attachments_on_issue_copy => 'no' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_no_difference 'Attachment.count' do + post( + :create, + :params => { + :project_id => 1, + :copy_from => 3, + :issue => { + :subject => 'Copy' + } + } + ) + end + end + end + end + def test_create_as_copy_should_copy_subtasks @request.session[:user_id] = 2 issue = Issue.generate_with_descendants! @@ -8085,6 +8126,47 @@ class IssuesControllerTest < Redmine::ControllerTest end end + def test_bulk_copy_should_never_copy_attachments_by_settings + with_settings :copy_attachments_on_issue_copy => 'no' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_no_difference 'Attachment.count' do + post( + :bulk_update, + :params => { + :ids => [3], + :copy => '1', + :issue => { + :project_id => '' + } + } + ) + end + end + end + end + + def test_bulk_copy_should_always_copy_attachments_by_settings + assert_equal 4, Issue.find(3).attachments.size + with_settings :copy_attachments_on_issue_copy => 'yes' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_difference 'Attachment.count', 4 do + post( + :bulk_update, + :params => { + :ids => [3], + :copy => '1', + :issue => { + :project_id => '' + } + } + ) + end + end + end + end + def test_bulk_copy_should_add_relations_with_copied_issues @request.session[:user_id] = 2 assert_difference 'Issue.count', 2 do