mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 22:05:56 +01:00
Fix "Page not found" error when saving workflows with many statuses on Rack >= 3.1.14 (#42875).
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23841 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -211,6 +211,45 @@ class WorkflowsControllerTest < Redmine::ControllerTest
|
||||
assert w.assignee
|
||||
end
|
||||
|
||||
def test_post_edit_with_large_number_of_statuses
|
||||
# This test ensures that workflows with many statuses can be saved.
|
||||
# Without setting `ENV['RACK_QUERY_PARSER_PARAMS_LIMIT']`, this raises
|
||||
# ActionController::BadRequest exception due to exceeding the default
|
||||
# query parameter limit of 4096.
|
||||
WorkflowTransition.delete_all
|
||||
|
||||
num_statuses = 40
|
||||
transitions_data = {}
|
||||
|
||||
# Allowed statuses for a new issue (status_id = 0)
|
||||
transitions_data['0'] = {}
|
||||
(1..num_statuses).each do |status_id|
|
||||
transitions_data['0'][status_id.to_s] = {'always' => '1'}
|
||||
end
|
||||
|
||||
# Status transitions between statuses
|
||||
(1..num_statuses).each do |status_id_from| # rubocop:disable RuboCopStyle/CombinableLoops
|
||||
transitions_data[status_id_from.to_s] = {}
|
||||
(1..num_statuses).each do |status_id_to|
|
||||
# skip self-transitions
|
||||
next if status_id_from == status_id_to
|
||||
|
||||
transitions_data[status_id_from.to_s][status_id_to.to_s] = {
|
||||
'always' => '1', 'author' => '1', 'assignee' => '1'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
patch :update, :params => {
|
||||
:role_id => 2,
|
||||
:tracker_id => 1,
|
||||
:transitions => transitions_data
|
||||
}
|
||||
end
|
||||
assert_response :found
|
||||
end
|
||||
|
||||
def test_get_permissions
|
||||
get :permissions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user