summaryrefslogtreecommitdiffstats
path: root/app/controllers/roles_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/roles_controller.rb')
-rw-r--r--app/controllers/roles_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index dfe7c2b8f..89f9ee497 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -99,7 +99,15 @@ class RolesController < ApplicationController
begin
@role.destroy
rescue
- flash[:error] = l(:error_can_not_remove_role)
+ flash[:error] = l(:error_can_not_remove_role)
+
+ if @role.members.present?
+ projects = Project.joins(members: :member_roles).where(member_roles: { role_id: @role.id }).distinct.sorted
+ links = projects.map do |p|
+ view_context.link_to(p, settings_project_path(p, tab: 'members'))
+ end.join(', ')
+ flash[:error] += l(:error_can_not_remove_role_reason_members_html, projects: links)
+ end
end
redirect_to roles_path
end