##// END OF EJS Templates
Only show statuses that can be applied to all issues on the bulk edit form (#10181)....
Jean-Philippe Lang -
r8724:2ec55c5337f9
parent child
Show More
@@ -229,7 +229,7 class IssuesController < ApplicationController
229 229 end
230 230 target_projects ||= @projects
231 231
232 @available_statuses = target_projects.map{|p|Workflow.available_statuses(p)}.reduce(:&)
232 @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
233 233 @custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.reduce(:&)
234 234 @assignables = target_projects.map(&:assignable_users).reduce(:&)
235 235 @trackers = target_projects.map(&:trackers).reduce(:&)
@@ -2523,6 +2523,26 class IssuesControllerTest < ActionController::TestCase
2523 2523 }
2524 2524 end
2525 2525
2526 def test_bulk_edit_should_only_propose_statuses_allowed_for_all_issues
2527 Workflow.delete_all
2528 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 1)
2529 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3)
2530 Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4)
2531 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 1)
2532 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 3)
2533 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 5)
2534 @request.session[:user_id] = 2
2535 get :bulk_edit, :ids => [1, 2]
2536
2537 assert_response :success
2538 statuses = assigns(:available_statuses)
2539 assert_not_nil statuses
2540 assert_equal [1, 3], statuses.map(&:id).sort
2541
2542 assert_tag 'select', :attributes => {:name => 'issue[status_id]'},
2543 :children => {:count => 3} # 2 statuses + "no change" option
2544 end
2545
2526 2546 def test_bulk_update
2527 2547 @request.session[:user_id] = 2
2528 2548 # update issues priority
General Comments 0
You need to be logged in to leave comments. Login now