Feature #42441
closed
Improve error message on role deletion by listing projects using the role
Added by Mizuki ISHIKAWA 7 months ago.
Updated about 2 months ago.
Description
Currently, when attempting to delete a role that is in use, the following message is displayed: This role is in use and cannot be deleted.
However, this message does not provide enough information to understand which projects are using the role and how to resolve the issue.
Proposal:
Enhance the error message to include a list of projects where this role is currently assigned to members.
For example:

Clicking on the project link will take you to the members tab of the settings for that project.
This way, the user can easily identify which project members they need to update before they can delete the role.
A similar improvement was made in #12521 to display detailed information in error messages for better guidance.
Files
Attached is a patch that adds a project link to the error message
- Target version set to 6.1.0
Setting the target version to 6.1.0.
- Assignee set to Mizuki ISHIKAWA
In the suggested patch, the projects variable set at the following line in RolesController#destroy does not appear to be used.
Could you check the patch?
projects = Project.joins(:members).where(members: { role_id: @role.id }).distinct.sorted
Go MAEDA wrote in #note-3:
In the suggested patch, the projects variable set at the following line in RolesController#destroy does not appear to be used.
Could you check the patch?
[...]
You're right. There was an issue with the patch, so I've re-attached the corrected version.
- Status changed from New to Closed
- Assignee changed from Mizuki ISHIKAWA to Go MAEDA
- Resolution set to Fixed
Committed the patch in r23619. Thank you.
- Status changed from Closed to Reopened
- Related to Defect #43164: Deleting role that used by many projects raises CookieOverflow error added
- Status changed from Reopened to Closed
Also available in: Atom
PDF