From ae6aa34c85fe881afef4399e7edb7c44e8be2e03 Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Wed, 27 Nov 2024 15:09:31 +0000 Subject: [PATCH] Add feature flag and link for system returns notifications https://eaflood.atlassian.net/browse/WATER-4716 The previous change to introduce this toggle - https://github.com/DEFRA/water-abstraction-ui/pull/2643 The previous change was based on the assumption of invitations and reminders being seperated. After discussion this is no longer the case. That journey could be built as one. However, for now the feature flag has been updated to be more concise and reusable in relation to system notifications. And not specific to invitations. As part of the ongoing work to migrate the legacy ui pages into the system repo. We need to redirect the user to the newly created pages / journey when it is ready. This change adds a feature flag to the manage page for the return notifications invitations link. When the feature flag is on it will redirect the user to the new page / journey built in system --- .env.example | 2 +- src/internal/config.js | 2 +- src/internal/modules/manage/lib/manage-nav.js | 4 ++-- test/internal/modules/manage/lib/manage-nav.test.js | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 999e217ea..ff14ad421 100644 --- a/.env.example +++ b/.env.example @@ -55,7 +55,7 @@ TRIGGER_SROC_TWO_PART_TARIFF= TRIGGER_SROC_ANNUAL= SHOW_RETURN_REQUIREMENTS= USE_NEW_BILL_RUN_SETUP= -ENABLE_SYSTEM_NOTIFICATIONS_INVITATIONS= +ENABLE_SYSTEM_NOTIFICATIONS= # Set log level for app. Default is 'info' WRLS_LOG_LEVEL=debug diff --git a/src/internal/config.js b/src/internal/config.js index 88bbf8520..d0252ac8a 100644 --- a/src/internal/config.js +++ b/src/internal/config.js @@ -175,7 +175,7 @@ module.exports = { useNewBillRunSetup: (get(process.env, 'USE_NEW_BILL_RUN_SETUP') || '').toLowerCase() === 'true', useWorkflowSetupLinks: (get(process.env, 'USE_WORKFLOW_SETUP_LINKS') || 'true').toLowerCase() === 'true', enableSystemLicenceView: process.env.ENABLE_SYSTEM_LICENCE_VIEW === 'true', - enableSystemNotificationsInvitations: process.env.ENABLE_SYSTEM_NOTIFICATIONS_INVITATIONS === 'true', + enableSystemNotifications: process.env.ENABLE_SYSTEM_NOTIFICATIONS === 'true', enableMonitoringStationsView: process.env.ENABLE_MONITORING_STATIONS_VIEW === 'true' }, billRunsToDisplayPerPage: process.env.BILL_RUNS_TO_DISPLAY_PER_PAGE || 20 diff --git a/src/internal/modules/manage/lib/manage-nav.js b/src/internal/modules/manage/lib/manage-nav.js index bd6d29293..4dfc777be 100644 --- a/src/internal/modules/manage/lib/manage-nav.js +++ b/src/internal/modules/manage/lib/manage-nav.js @@ -67,8 +67,8 @@ const getManageTabConfig = request => mapValues( ) const _returnNotificationsInvitations = () => { - if (config.featureToggles.enableSystemNotificationsInvitations) { - return '/system/notifications/invitations/setup/returns-period' + if (config.featureToggles.enableSystemNotifications) { + return '/system/notifications/setup/returns-period' } else { return '/returns-notifications/invitations' } diff --git a/test/internal/modules/manage/lib/manage-nav.test.js b/test/internal/modules/manage/lib/manage-nav.test.js index 435645cc4..1bbf47785 100644 --- a/test/internal/modules/manage/lib/manage-nav.test.js +++ b/test/internal/modules/manage/lib/manage-nav.test.js @@ -45,7 +45,7 @@ experiment('getManageTabConfig', () => { experiment('when user has bulk returns notifications scope', () => { beforeEach(() => { - config.featureToggles.enableSystemNotificationsInvitations = false + config.featureToggles.enableSystemNotifications = false }) test('they can view notification report, return invitations and return reminders notifications', async () => { @@ -224,9 +224,9 @@ experiment('getManageTabConfig', () => { }) }) - experiment('when the "enableSystemNotificationsInvitations" flag is true', () => { + experiment('when the "enableSystemNotifications" flag is true', () => { beforeEach(() => { - config.featureToggles.enableSystemNotificationsInvitations = true + config.featureToggles.enableSystemNotifications = true }) test('they click the link to "system"', async () => { @@ -235,7 +235,7 @@ experiment('getManageTabConfig', () => { expect(config.returnNotifications[0]).to.equal({ name: 'Invitations', - path: '/system/notifications/invitations/setup/returns-period', + path: '/system/notifications/setup/returns-period', scopes: 'bulk_return_notifications' }) })