Feature #42073
closedRemove navigation parameters from issue detail URLs after updates
0%
Description
This patch removes navigation parameters from the issue detail URL after updating an issue.
Before applying the patch:
http://localhost:3000/issues/2?issue_count=8&issue_position=2&next_issue_id=3&prev_issue_id=1
After applying the patch:
http://localhost:3000/issues/2
Background/Purpose¶
Currently, the URL of the issue detail screen after updating an issue includes navigation parameters like:
http://localhost:3000/issues/2?issue_count=8&issue_position=2&next_issue_id=3&prev_issue_id=1
These navigation parameters are used to display navigation in the issue detail screen:
- prev_issue_id: The issue linked to the "Previous" button
- next_issue_id: The issue linked to the "Next" button
- issue_position, issue_count: Position information (e.g., "7 of 8")
The navigation is normally displayed based on the active filter and sort conditions. However, if the URL with navigation parameters is used, it is always displayed based on the parameter values, regardless of the current filter or sort settings.
For example, sharing the URL may cause incorrect navigation to appear for others. I think the URL should not be shareable.
Solution¶
This patch uses Flash to pass navigation information (e.g., next_issue_id
, prev_issue_id
) after updating an issue, removing the need to include navigation parameters in the URL. This ensures that a clean, shareable URL (e.g., http://example.net/issues/123
) is maintained.
Additionally, users no longer need to manually remove unnecessary parameters when copying the URL from the browser’s address bar.
I confirmed all tests passed after applying the patch.
https://github.com/hidakatsuya/redmine/actions/runs/12620683503
Files
Updated by Go MAEDA 5 months ago
- Target version changed from Candidate for next major release to 6.1.0
The changes look good to me. I have confirmed that the functionality works as expected. The improvement of removing unnecessary parameters from the issue URL is valuable.
I am setting the target version to 6.1.0.
Updated by Katsuya HIDAKA 6 days ago
- File fix-render_flash_messages-to-ignore-non-string-flash-values-and-prevent-errors.patch fix-render_flash_messages-to-ignore-non-string-flash-values-and-prevent-errors.patch added
I found that, in very rare cases, if you navigate to another page immediately after updating an issue, but before the issue detail page finishes loading, the flash (cookie) may not be cleared. As a result, an error occurs in render_flash_messages
:
ActionView::Template::Error (undefined method 'html_safe' for an instance of Hash): Causes: NoMethodError (undefined method 'html_safe' for an instance of Hash) 116: <%= yield :sidebar %> 117: <%= view_layouts_base_sidebar_hook_response %> 118: </div> 119: </div> 120: 121: <div id="content"> 122: <%= render_flash_messages %> app/helpers/application_helper.rb:521:in 'block in ApplicationHelper#render_flash_messages'
Once this error occurs, it cannot be resolved until you clear your cookies by restarting your browser.
Additionally, this issue may also occur on the backup code registration screen for two-factor authentication:
https://github.com/redmine/redmine/blob/6824ee98f4df5fc777fb3bf8dcb1abf570dd8023/app/controllers/twofa_backup_codes_controller.rb#L63
I've attached a patch to fix this issue. This patch updates render_flash_messages
to ignore non-string flash values.
Updated by Go MAEDA 6 days ago
Katsuya HIDAKA wrote in #note-4:
I found that, in very rare cases, if you navigate to another page immediately after updating an issue, but before the issue detail page finishes loading, the flash (cookie) may not be cleared. As a result, an error occurs in
render_flash_messages
:[...]
Once this error occurs, it cannot be resolved until you clear your cookies by restarting your browser.
Additionally, this issue may also occur on the backup code registration screen for two-factor authentication:
https://github.com/redmine/redmine/blob/6824ee98f4df5fc777fb3bf8dcb1abf570dd8023/app/controllers/twofa_backup_codes_controller.rb#L63I've attached a patch to fix this issue. This patch updates
render_flash_messages
to ignore non-string flash values.
Committed the fix in r23821. Thank you.