diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-29 09:06:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-29 09:06:32 +0000 |
commit | f078f7127c4521d196e82dc648866525767d5178 (patch) | |
tree | 875797e84d509aeba447bdd9ce011162c566db7b | |
parent | c2cd4b7f48bed9da259ebdeac767f92a7e92491b (diff) | |
download | redmine-f078f7127c4521d196e82dc648866525767d5178.tar.gz redmine-f078f7127c4521d196e82dc648866525767d5178.zip |
Merged r5283 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@5590 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 8 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 12 |
2 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 051f89107..66aa00ca2 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -236,7 +236,13 @@ class IssuesController < ApplicationController return unless api_request? end end - @issues.each(&:destroy) + @issues.each do |issue| + begin + issue.reload.destroy + rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists + # nothing to do, issue was already deleted (eg. by a parent) + end + end respond_to do |format| format.html { redirect_back_or_default(:action => 'index', :project_id => @project) } format.api { head :ok } diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index b21b28e66..b0fac1657 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1286,6 +1286,18 @@ class IssuesControllerTest < ActionController::TestCase assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6)) end + def test_destroy_parent_and_child_issues + parent = Issue.generate!(:project_id => 1, :tracker_id => 1) + child = Issue.generate!(:project_id => 1, :tracker_id => 1, :parent_issue_id => parent.id) + assert child.is_descendant_of?(parent.reload) + + @request.session[:user_id] = 2 + assert_difference 'Issue.count', -2 do + post :destroy, :ids => [parent.id, child.id], :todo => 'destroy' + end + assert_response 302 + end + def test_default_search_scope get :index assert_tag :div, :attributes => {:id => 'quick-search'}, |