Defect #42458
closed"For all projects" checkbox should be disabled when editing an existing query in which the checkbox is already checked
0%
Description
Currently, when editing an existing query that is set for all projects (global query), users can uncheck the "For all projects" checkbox, but this change is not actually saved when the form is submitted. This inconsistency between the UI and the actual behavior can lead to confusion. Even though the checkbox appears to be changeable in the interface, the system silently ignores this change when the Save button is pressed, which creates a misleading user experience.
This patch modifies the query form to disable the "For all projects" checkbox when editing an existing query where this option is already checked (where @query.project.nil? is true and @query.new_record? is false). This makes the UI behavior consistent with the actual system behavior and prevents users from attempting to make changes that won't be saved.
The implementation adds a simple conditional to the checkbox's disabled attribute:
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :disabled => (!@query.new_record? && @query.project.nil?), :class => (User.current.admin? ? '' : 'disable-unless-private') %>
This ensures that:
- For new queries (both project-specific and global), the checkbox remains enabled
- For existing queries where "For all projects" is checked, the checkbox is disabled and cannot be unchecked
- For existing project-specific queries, the checkbox remains enabled
Files
Related issues
Updated by Go MAEDA 7 days ago
- Related to Defect #28033: Unable to turn off "For all projects" flag of custom queries added
Updated by Go MAEDA 6 days ago
- File 42458-v2.patch 42458-v2.patch added
I have updated the patch. In this version, the tests that were originally added in queries_controller_is_for_all_test.rb
have been moved to the existing queries_controller_test.rb
.
Updated by [Agileware] nusohiro 6 days ago
Thanks for the update! Looks good to me!
Updated by Go MAEDA 5 days ago
- Tracker changed from Patch to Defect
- Subject changed from Fix disable "For all projects" checkbox when it's checked in existing queries to "For all projects" checkbox should be disabled when editing an existing query in which the checkbox is already checked
- Target version changed from Candidate for next minor release to 5.1.8
Setting the target version to 5.1.8.