Project

General

Profile

Actions

Defect #42458

closed

"For all projects" checkbox should be disabled when editing an existing query in which the checkbox is already checked

Added by [Agileware] nusohiro 10 days ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

Related to Redmine - Defect #28033: Unable to turn off "For all projects" flag of custom queriesNew

Actions
Actions #1

Updated by Go MAEDA 7 days ago

  • Related to Defect #28033: Unable to turn off "For all projects" flag of custom queries added
Actions #2

Updated by Go MAEDA 7 days ago

  • Category set to Issues
  • Target version set to Candidate for next minor release
Actions #3

Updated by Go MAEDA 6 days ago

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.

Actions #4

Updated by [Agileware] nusohiro 6 days ago

Thanks for the update! Looks good to me!

Actions #5

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.

Actions #6

Updated by Go MAEDA 4 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r23573. Thank you for your contribution.

Actions #7

Updated by Go MAEDA 3 days ago

  • Status changed from Resolved to Closed

Merged the fix into the stable branches in r23579 and r23580.

Actions

Also available in: Atom PDF