From e5867ffc8d20cbfc075afa9f1151d2266fe9f95d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 3 Nov 2024 07:11:07 +0000 Subject: Improve tracker deletion error message to display projects containing issues under the tracker (#12521). Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23181 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/trackers_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index c1415bc2c..824ce93ef 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -89,7 +89,11 @@ class TrackersController < ApplicationController def destroy @tracker = Tracker.find(params[:id]) unless @tracker.issues.empty? - flash[:error] = l(:error_can_not_delete_tracker) + 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)) + end.join(', ') + flash[:error] = l(:error_can_not_delete_tracker_html, projects: links.html_safe) else @tracker.destroy end -- cgit v1.2.3