mirror of
https://github.com/redmine/redmine.git
synced 2025-11-11 07:46:02 +01:00
Add configurable setting for copying attachments when copying an issue (#36197).
Patch by Yuichi HARADA (user:yui.har). git-svn-id: https://svn.redmine.org/redmine/trunk@22926 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user