From b88b61444c2782f518a54f6b81a2d802048b1c5c Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Thu, 1 Jan 2026 18:35:05 +0000 Subject: [PATCH] Update Rails to 8.1.1 (#43428, #43205). Patches by Takashi Kato (user:tohosaku). git-svn-id: https://svn.redmine.org/redmine/trunk@24248 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- Gemfile | 2 +- app/helpers/application_helper.rb | 7 ------- config/initializers/10-patches.rb | 19 +++++++++++++++++++ test/functional/issues_controller_test.rb | 2 +- test/functional/timelog_controller_test.rb | 6 +++--- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 3c9fc7815..e524e3c9a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '>= 3.2.0', '< 3.5.0' -gem 'rails', '8.0.4' +gem 'rails', '8.1.1' gem 'rouge', '~> 4.5' gem 'mini_mime', '~> 1.1.0' gem "actionpack-xml_parser" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 48373f72a..36a5f3e61 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1567,13 +1567,6 @@ module ApplicationHelper fields_for(*args, &) end - def form_tag_html(html_options) - # Set a randomized name attribute on all form fields by default - # as a workaround to https://bugzilla.mozilla.org/show_bug.cgi?id=1279253 - html_options['name'] ||= "#{html_options['id'] || 'form'}-#{SecureRandom.hex(4)}" - super - end - # Render the error messages for the given objects def error_messages_for(*objects) objects = objects.filter_map {|o| o.is_a?(String) ? instance_variable_get(:"@#{o}") : o} diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 7df46304a..b25ca00ae 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -102,6 +102,25 @@ module ActionView super end end) + module Helpers + # Set a randomized name attribute on all form fields by default + # as a workaround to https://bugzilla.mozilla.org/show_bug.cgi?id=1279253 + FormHelper.prepend(Module.new do + def form_tag_html(html_options) + randomized_name_attribute(html_options) + super + end + + def form_tag_with_body(html_options, output) + randomized_name_attribute(html_options) + super + end + + def randomized_name_attribute(html_options) + html_options['name'] ||= "#{html_options['id'] || 'form'}-#{SecureRandom.hex(4)}" + end + end) + end end module ActionController diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 10bb9906e..7102d3262 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -6984,7 +6984,7 @@ class IssuesControllerTest < Redmine::ControllerTest :update, params: { id: private_issue.id, - issue: { assigned_to_id: nil }, + issue: { assigned_to_id: '' }, time_entry: { comments: "add spent time", activity_id: TimeEntryActivity.first.id, hours: 1 } diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 8fda4610a..e177eda07 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -430,7 +430,7 @@ class TimelogControllerTest < Redmine::ControllerTest }, :continue => '1' } - assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14' + assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14' end end @@ -464,7 +464,7 @@ class TimelogControllerTest < Redmine::ControllerTest }, :continue => '1' } - assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14' + assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14' end end @@ -481,7 +481,7 @@ class TimelogControllerTest < Redmine::ControllerTest }, :continue => '1' } - assert_redirected_to '/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D=&time_entry%5Bspent_on%5D=2008-03-14' + assert_redirected_to '/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D&time_entry%5Bspent_on%5D=2008-03-14' end end