@@ -235,6 +235,13 class IssuesController < ApplicationController | |||||
235 |
|
235 | |||
236 | unsaved_issue_ids = [] |
|
236 | unsaved_issue_ids = [] | |
237 | moved_issues = [] |
|
237 | moved_issues = [] | |
|
238 | ||||
|
239 | if @copy && params[:copy_subtasks].present? | |||
|
240 | # Descendant issues will be copied with the parent task | |||
|
241 | # Don't copy them twice | |||
|
242 | @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}} | |||
|
243 | end | |||
|
244 | ||||
238 | @issues.each do |issue| |
|
245 | @issues.each do |issue| | |
239 | issue.reload |
|
246 | issue.reload | |
240 | if @copy |
|
247 | if @copy |
@@ -3539,6 +3539,21 class IssuesControllerTest < ActionController::TestCase | |||||
3539 | assert_equal count, copy.descendants.count |
|
3539 | assert_equal count, copy.descendants.count | |
3540 | end |
|
3540 | end | |
3541 |
|
3541 | |||
|
3542 | def test_bulk_copy_should_not_copy_selected_subtasks_twice | |||
|
3543 | issue = Issue.generate_with_descendants!(Project.find(1), :subject => 'Parent') | |||
|
3544 | count = issue.descendants.count | |||
|
3545 | @request.session[:user_id] = 2 | |||
|
3546 | ||||
|
3547 | assert_difference 'Issue.count', count+1 do | |||
|
3548 | post :bulk_update, :ids => issue.self_and_descendants.map(&:id), :copy => '1', :copy_subtasks => '1', | |||
|
3549 | :issue => { | |||
|
3550 | :project_id => '' | |||
|
3551 | } | |||
|
3552 | end | |||
|
3553 | copy = Issue.where(:parent_id => nil).order("id DESC").first | |||
|
3554 | assert_equal count, copy.descendants.count | |||
|
3555 | end | |||
|
3556 | ||||
3542 | def test_bulk_copy_to_another_project_should_follow_when_needed |
|
3557 | def test_bulk_copy_to_another_project_should_follow_when_needed | |
3543 | @request.session[:user_id] = 2 |
|
3558 | @request.session[:user_id] = 2 | |
3544 | post :bulk_update, :ids => [1], :copy => '1', :issue => {:project_id => 2}, :follow => '1' |
|
3559 | post :bulk_update, :ids => [1], :copy => '1', :issue => {:project_id => 2}, :follow => '1' |
General Comments 0
You need to be logged in to leave comments.
Login now