Эх сурвалжийг харах

[web] Remove CIAM login notification and cookie (#31563)

* Remove legacy notification cookies

* Remove CIAM notification message from login page

* Remove e2e test "it can dismiss the login notification"

* Clarify comment about removing legacy notification dismiss cookies

GitOrigin-RevId: 33fdc02a397c0f4be491f030ab58fd8954276048
Antoine Clausse 5 сар өмнө
parent
commit
43832b7a43

+ 15 - 1
services/web/app/src/infrastructure/ExpressLocals.mjs

@@ -338,11 +338,25 @@ export default async function (webRouter, privateApiRouter, publicApiRouter) {
   })
 
   webRouter.use(function (req, res, next) {
+    // Notifications that are no longer used for which we want to remove the dismiss cookies.
+    // This can be removed after some time
+    const LEGACY_NOTIFICATIONS = [{ id: 'ciaminfo', paths: ['/login'] }]
+
     const KEY_PREFIX = 'readnotif-'
     const dismissedNotifications = []
     for (const cookieName in req.cookies) {
       if (cookieName.startsWith(KEY_PREFIX)) {
-        dismissedNotifications.push(cookieName.slice(KEY_PREFIX.length))
+        const legacyNotification = LEGACY_NOTIFICATIONS.find(
+          ({ id }) => cookieName === `${KEY_PREFIX}${id}`
+        )
+        if (legacyNotification) {
+          // Remove the cookie for legacy notifications that we no longer use.
+          for (const path of legacyNotification.paths) {
+            res.clearCookie(cookieName, { path, domain: Settings.cookieDomain })
+          }
+        } else {
+          dismissedNotifications.push(cookieName.slice(KEY_PREFIX.length))
+        }
       }
     }
     res.locals.dismissedNotifications = dismissedNotifications

+ 0 - 1
services/web/locales/en.json

@@ -345,7 +345,6 @@
   "choose_how_you_search_your_references": "Choose how you search your references",
   "choose_which_experiments": "Choose which experiments you’d like to try.",
   "choose_your_plan": "Choose your plan",
-  "ciam_info_login": "We’re making some changes to improve your login experience. You’ll start seeing a new look, including mentions of our parent company, Digital Science. Don’t worry, this won’t change your account or login options.",
   "citation": "Citation",
   "citation_checks_are_powered_by_trusted_sources_from_dimensions": "Citation checks are powered by trusted sources from Dimensions.",
   "cite_a_reference_from_your_reference_manager_to_automatically_add_it_to_your_bib_file": "Cite a reference from your reference manager to automatically add it to your .bib file.",