From 22aa7a17b2ab46e06e2e39c2296ad0e054bfd265 Mon Sep 17 00:00:00 2001 From: Jessica Lawshe <5312836+lawshe@users.noreply.github.com> Date: Wed, 6 Dec 2023 07:05:54 -0600 Subject: [PATCH] Merge pull request #16053 from overleaf/jel-project-dash-sso-linked-alert [web] Show group SSO linked notification GitOrigin-RevId: f66f68dd647963f53b3978931088ba23bab78273 --- .../Features/Project/ProjectListController.js | 15 ++++++++--- services/web/app/views/project/list-react.pug | 1 + .../web/frontend/extracted-translations.json | 1 + .../groups/group-sso-setup-success.tsx | 24 ++++++++++++++++++ .../notifications/user-notifications.tsx | 2 ++ .../stylesheets/app/project-list.less | 5 ++++ services/web/locales/en.json | 1 + .../components/notifications.test.tsx | 25 +++++++++++++++++++ 8 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 services/web/frontend/js/features/project-list/components/notifications/groups/group-sso-setup-success.tsx diff --git a/services/web/app/src/Features/Project/ProjectListController.js b/services/web/app/src/Features/Project/ProjectListController.js index e5bb2a6c82..90f09b23fc 100644 --- a/services/web/app/src/Features/Project/ProjectListController.js +++ b/services/web/app/src/Features/Project/ProjectListController.js @@ -214,7 +214,8 @@ async function projectListPage(req, res, next) { } const notificationsInstitution = [] - // Institution SSO Notifications + // Institution and group SSO Notifications + let groupSsoSetupSuccess let reconfirmedViaSAML if (Features.hasFeature('saml')) { reconfirmedViaSAML = _.get(req.session, ['saml', 'reconfirmed']) @@ -240,7 +241,7 @@ async function projectListPage(req, res, next) { } if (samlSession) { - // Notification: After SSO Linked + // Notification institution SSO: After SSO Linked if (samlSession.linked) { notificationsInstitution.push({ email: samlSession.institutionEmail, @@ -251,7 +252,12 @@ async function projectListPage(req, res, next) { }) } - // Notification: After SSO Linked or Logging in + // Notification group SSO: After SSO Linked + if (samlSession.linkedGroup) { + groupSsoSetupSuccess = true + } + + // Notification institution SSO: After SSO Linked or Logging in // The requested email does not match primary email returned from // the institution if ( @@ -266,7 +272,7 @@ async function projectListPage(req, res, next) { }) } - // Notification: Tried to register, but account already existed + // Notification institution SSO: Tried to register, but account already existed // registerIntercept is set before the institution callback. // institutionEmail is set after institution callback. // Check for both in case SSO flow was abandoned @@ -500,6 +506,7 @@ async function projectListPage(req, res, next) { inrGeoBannerSplitTestName, projectDashboardReact: true, // used in navbar welcomePageRedesignVariant: welcomePageRedesignAssignment.variant, + groupSsoSetupSuccess, groupSubscriptionsPendingEnrollment: groupSubscriptionsPendingEnrollment.map(subscription => ({ groupId: subscription._id, diff --git a/services/web/app/views/project/list-react.pug b/services/web/app/views/project/list-react.pug index c4daf83305..67e0747500 100644 --- a/services/web/app/views/project/list-react.pug +++ b/services/web/app/views/project/list-react.pug @@ -37,6 +37,7 @@ block append meta meta(name="ol-groupSubscriptionsPendingEnrollment" data-type="json" content=groupSubscriptionsPendingEnrollment) meta(name="ol-hasIndividualRecurlySubscription" data-type="boolean" content=hasIndividualRecurlySubscription) meta(name="ol-newNotificationStyle" data-type="boolean" content=newNotificationStyle) + meta(name="ol-groupSsoSetupSuccess" data-type="boolean" content=groupSsoSetupSuccess) block content main.content.content-alt.project-list-react#project-list-root diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 689b98efb6..44649d2ed6 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -1180,6 +1180,7 @@ "subscription_canceled_and_terminate_on_x": "", "subscription_will_remain_active_until_end_of_billing_period_x": "", "subscription_will_remain_active_until_end_of_trial_period_x": "", + "success_sso_set_up": "", "suggested": "", "sure_you_want_to_cancel_plan_change": "", "sure_you_want_to_change_plan": "", diff --git a/services/web/frontend/js/features/project-list/components/notifications/groups/group-sso-setup-success.tsx b/services/web/frontend/js/features/project-list/components/notifications/groups/group-sso-setup-success.tsx new file mode 100644 index 0000000000..b9cb718f33 --- /dev/null +++ b/services/web/frontend/js/features/project-list/components/notifications/groups/group-sso-setup-success.tsx @@ -0,0 +1,24 @@ +import { useTranslation } from 'react-i18next' +import Notification from '../../../../../shared/components/notification' +import getMeta from '../../../../../utils/meta' + +function GroupSsoSetupSuccess() { + const { t } = useTranslation() + const wasSuccess = getMeta('ol-groupSsoSetupSuccess') + + if (!wasSuccess) { + return null + } + + return ( +