From bbbf81b4f0741baab75eb22fd85dd64576a5ff33 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Tue, 3 Sep 2024 09:37:25 +0100 Subject: [PATCH] Fix path checks around notification viewing --- app/helpers/application_helper.rb | 4 ++-- app/helpers/navigation_items_helper.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 01f7734c2..4737f26c1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -12,7 +12,7 @@ module ApplicationHelper def govuk_header_classes(current_user) if current_user&.support? "app-header app-header--orange" - elsif ((current_user.blank? && Notification.active_unauthenticated_notifications.present?) || current_user&.active_unread_notifications.present?) && !current_page?(notifications_path) + elsif notifications_to_display? "app-header app-header__no-border-bottom" else "app-header" @@ -28,7 +28,7 @@ module ApplicationHelper end def notifications_to_display? - !current_page?(notifications_path) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?) + !request.path.match?(/^\/notifications\/\d+$/) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?) end private diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb index 1cecb97ec..6a5bece9e 100644 --- a/app/helpers/navigation_items_helper.rb +++ b/app/helpers/navigation_items_helper.rb @@ -47,7 +47,7 @@ module NavigationItemsHelper private def home_current?(path) - path == root_path || path == notifications_path + path == root_path || path.match?(/^\/notifications\/\d+$/) end def lettings_logs_current?(path)