1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

CookieOverflow error when deleting a tracker used by many projects (#43174).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23939 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2025-09-05 06:45:30 +00:00
parent 9b4f905c78
commit e06b4a8435
2 changed files with 8 additions and 6 deletions

View File

@ -88,16 +88,18 @@ class TrackersController < ApplicationController
def destroy
@tracker = Tracker.find(params[:id])
unless @tracker.issues.empty?
if @tracker.issues.empty?
@tracker.destroy
redirect_to trackers_path
else
projects = Project.joins(:issues).where(issues: {tracker_id: @tracker.id}).sorted.distinct
links = projects.map do |p|
view_context.link_to(p, project_issues_path(p, set_filter: 1, tracker_id: @tracker.id, status_id: '*'))
end.join(', ')
flash[:error] = l(:error_can_not_delete_tracker_html, projects: links.html_safe)
else
@tracker.destroy
flash.now[:error] = l(:error_can_not_delete_tracker_html, projects: links.html_safe)
@trackers = Tracker.sorted.preload(:default_status).to_a
render :index
end
redirect_to trackers_path
end
def fields

View File

@ -282,7 +282,7 @@ class TrackersControllerTest < Redmine::ControllerTest
assert_no_difference 'Tracker.count' do
delete :destroy, params: {id: tracker.id}
end
assert_redirected_to action: 'index'
assert_response :success
assert_match /The following projects have issues with this tracker:/, flash[:error]
projects.each do |project|
assert_match /#{project.name}/, flash[:error]