From 6aea730a2f60b5ed9f8f366f13290c2cab03eed4 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:59:50 +0100 Subject: [PATCH] Revert "Sanitise name and use html safe" This reverts commit c6f5f154b0baa3fc6c5d9285839d468d83c1dbda. --- app/helpers/application_helper.rb | 7 ------- app/helpers/title_helper.rb | 7 +++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 01614902e..01f7734c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -31,13 +31,6 @@ module ApplicationHelper !current_page?(notifications_path) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?) end - def sanitise_text(text) - return if text.blank? - - text.gsub(/[^a-zA-Z0-9\s\-\_\'\&]/, "") - text.html_safe - end - private def paginated_title(title, pagy) diff --git a/app/helpers/title_helper.rb b/app/helpers/title_helper.rb index cc605cc28..25dcbc30c 100644 --- a/app/helpers/title_helper.rb +++ b/app/helpers/title_helper.rb @@ -4,12 +4,11 @@ module TitleHelper end def format_title(searched, page_title, current_user, item_label, count, organisation_name) - sanitised_organisation_name = sanitise_text(organisation_name) if searched.present? - actual_title = support_sab_nav?(current_user, organisation_name) ? sanitised_organisation_name : page_title - "#{actual_title} (#{count} #{item_label} matching ‘#{searched}’)".html_safe + actual_title = support_sab_nav?(current_user, organisation_name) ? organisation_name : page_title + "#{actual_title} (#{count} #{item_label} matching ‘#{searched}’)" else - support_sab_nav?(current_user, organisation_name) ? "#{sanitised_organisation_name} (#{page_title})".html_safe : page_title.html_safe + support_sab_nav?(current_user, organisation_name) ? "#{organisation_name} (#{page_title})" : page_title end end