OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
refactor[Op#55133]: Reduce fingerprint in FlashMessagesHelper mixin
Kabiru Mwenja1e03bb1be2c6
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rbindex f6c2984df9c..f2adb901acd 100644--- a/app/controllers/admin/settings/project_custom_fields_controller.rb+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb@@ -31,7 +31,7 @@ module Admin::Settingsinclude CustomFields::SharedActionsinclude OpTurbo::ComponentStreaminclude ApplicationComponentStreams- include FlashMessagesHelper+ include FlashMessagesOutputSafetyHelperinclude Admin::Settings::ProjectCustomFields::ComponentStreamsmenu_item :project_custom_fields_settingsdiff --git a/app/helpers/flash_messages_helper.rb b/app/helpers/flash_messages_helper.rbindex 47c7f190110..889111e5142 100644--- a/app/helpers/flash_messages_helper.rb+++ b/app/helpers/flash_messages_helper.rb@@ -31,8 +31,7 @@ module FlashMessagesHelperextend ActiveSupport::Concernincluded do- # For .safe_join in join_flash_messages- include ActionView::Helpers::OutputSafetyHelper+ include FlashMessagesOutputSafetyHelperenddef render_primer_banner_message?@@ -68,14 +67,6 @@ module FlashMessagesHelpersafe_join messages, "\n"end- def join_flash_messages(messages)- if messages.respond_to?(:join)- safe_join(messages, "<br />".html_safe)- else- messages- end- end-def render_flash_message(type, message, html_options = {}) # rubocop:disable Metrics/AbcSizeif type.to_s == "notice"type = "success"diff --git a/app/helpers/flash_messages_output_helper.rb b/app/helpers/flash_messages_output_helper.rbnew file mode 100644index 00000000000..56307941979--- /dev/null+++ b/app/helpers/flash_messages_output_helper.rb@@ -0,0 +1,45 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#+++#++module FlashMessagesOutputSafetyHelper+ extend ActiveSupport::Concern++ included do+ # For .safe_join in join_flash_messages+ include ActionView::Helpers::OutputSafetyHelper+ end++ def join_flash_messages(messages)+ if messages.respond_to?(:join)+ safe_join(messages, "<br />".html_safe)+ else+ messages+ end+ end+enddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 7c7983b3d81..bacb294a174 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -32,7 +32,7 @@class Storages::Admin::StoragesController < ApplicationControllerusing Storages::Peripherals::ServiceResultRefinements- include FlashMessagesHelper+ include FlashMessagesOutputSafetyHelperinclude OpTurbo::ComponentStream# See https://guides.rubyonrails.org/layouts_and_rendering.html for reference on layout