From b2d991d74a6349404a9a782d28773ec542cdf740 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:07:48 -0400 Subject: [PATCH] Merge pull request #21212 from overleaf/revert-20969-ac-subscription-layout-react Revert "[web] Set Subscription pages to have `layout-react`" GitOrigin-RevId: eaf3a651160e278adcb103864c5ea81ea3e35aa7 --- .../Features/Authentication/SessionManager.js | 6 ------ .../Subscription/TeamInvitesController.mjs | 4 ---- services/web/app/views/layout-react.pug | 1 - .../canceled-subscription-react.pug | 2 +- .../app/views/subscriptions/dashboard-react.pug | 2 +- .../successful-subscription-react.pug | 2 +- .../views/subscriptions/team/group-invites.pug | 2 +- .../views/subscriptions/team/invite-managed.pug | 2 +- .../web/app/views/subscriptions/team/invite.pug | 2 +- .../subscriptions/team/invite_logged_out.pug | 2 +- .../frontend/js/pages/user/subscription/base.js | 1 - .../frontend/js/shared/context/user-context.tsx | 6 ++---- services/web/frontend/js/utils/meta.ts | 4 ++-- services/web/types/user.ts | 16 ---------------- 14 files changed, 11 insertions(+), 41 deletions(-) diff --git a/services/web/app/src/Features/Authentication/SessionManager.js b/services/web/app/src/Features/Authentication/SessionManager.js index 0a89cc6f1d..a64ee98fe1 100644 --- a/services/web/app/src/Features/Authentication/SessionManager.js +++ b/services/web/app/src/Features/Authentication/SessionManager.js @@ -1,12 +1,6 @@ const _ = require('lodash') -/** @typedef {import('../../../../types/user').User} User */ - const SessionManager = { - /** - * @param session - * @returns {User | null} - */ getSessionUser(session) { const sessionUser = _.get(session, ['user']) const sessionPassportUser = _.get(session, ['passport', 'user']) diff --git a/services/web/app/src/Features/Subscription/TeamInvitesController.mjs b/services/web/app/src/Features/Subscription/TeamInvitesController.mjs index 8bf0e5dccc..b575c94ff8 100644 --- a/services/web/app/src/Features/Subscription/TeamInvitesController.mjs +++ b/services/web/app/src/Features/Subscription/TeamInvitesController.mjs @@ -169,16 +169,12 @@ async function viewInvite(req, res, next) { invite.email ) - /** @type {import('../../../../types/user').LoggedOutUser} */ - const userWithoutSensitiveFields = { id: null } - return res.render('subscriptions/team/invite_logged_out', { inviterName: invite.inviterName, inviteToken: invite.token, appName: settings.appName, accountExists: userByEmail != null, emailAddress: invite.email, - userWithoutSensitiveFields, }) } } diff --git a/services/web/app/views/layout-react.pug b/services/web/app/views/layout-react.pug index 277a2a29da..5fa3fec4b3 100644 --- a/services/web/app/views/layout-react.pug +++ b/services/web/app/views/layout-react.pug @@ -37,7 +37,6 @@ block append meta subdomainLang: settings.i18n.subdomainLang, translatedLanguages: settings.translatedLanguages }) - meta(name="ol-user" data-type="json" content=(userWithoutSensitiveFields || getSessionUser())) block body if (typeof suppressNavbar === "undefined") diff --git a/services/web/app/views/subscriptions/canceled-subscription-react.pug b/services/web/app/views/subscriptions/canceled-subscription-react.pug index f7b01222fc..16e5283f7c 100644 --- a/services/web/app/views/subscriptions/canceled-subscription-react.pug +++ b/services/web/app/views/subscriptions/canceled-subscription-react.pug @@ -1,4 +1,4 @@ -extends ../layout-react +extends ../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/dashboard-react.pug b/services/web/app/views/subscriptions/dashboard-react.pug index 69f71fbc99..068f52de0a 100644 --- a/services/web/app/views/subscriptions/dashboard-react.pug +++ b/services/web/app/views/subscriptions/dashboard-react.pug @@ -1,4 +1,4 @@ -extends ../layout-react +extends ../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/successful-subscription-react.pug b/services/web/app/views/subscriptions/successful-subscription-react.pug index 8a0ba23f57..0d82346b6f 100644 --- a/services/web/app/views/subscriptions/successful-subscription-react.pug +++ b/services/web/app/views/subscriptions/successful-subscription-react.pug @@ -1,4 +1,4 @@ -extends ../layout-react +extends ../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/team/group-invites.pug b/services/web/app/views/subscriptions/team/group-invites.pug index 90f2694d80..c9da04d293 100644 --- a/services/web/app/views/subscriptions/team/group-invites.pug +++ b/services/web/app/views/subscriptions/team/group-invites.pug @@ -1,4 +1,4 @@ -extends ../../layout-react +extends ../../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/team/invite-managed.pug b/services/web/app/views/subscriptions/team/invite-managed.pug index d4a7a9511f..8260db2562 100644 --- a/services/web/app/views/subscriptions/team/invite-managed.pug +++ b/services/web/app/views/subscriptions/team/invite-managed.pug @@ -1,4 +1,4 @@ -extends ../../layout-react +extends ../../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/team/invite.pug b/services/web/app/views/subscriptions/team/invite.pug index 5f6238dd09..c5ff57528b 100644 --- a/services/web/app/views/subscriptions/team/invite.pug +++ b/services/web/app/views/subscriptions/team/invite.pug @@ -1,4 +1,4 @@ -extends ../../layout-react +extends ../../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/app/views/subscriptions/team/invite_logged_out.pug b/services/web/app/views/subscriptions/team/invite_logged_out.pug index 87b79a8095..cac4cc37cd 100644 --- a/services/web/app/views/subscriptions/team/invite_logged_out.pug +++ b/services/web/app/views/subscriptions/team/invite_logged_out.pug @@ -1,4 +1,4 @@ -extends ../../layout-react +extends ../../layout-marketing block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' diff --git a/services/web/frontend/js/pages/user/subscription/base.js b/services/web/frontend/js/pages/user/subscription/base.js index 54b891c24e..f3cd062324 100644 --- a/services/web/frontend/js/pages/user/subscription/base.js +++ b/services/web/frontend/js/pages/user/subscription/base.js @@ -6,4 +6,3 @@ import '../../../features/contact-form' import '../../../features/event-tracking' import '../../../features/cookie-banner' import '../../../features/link-helpers/slow-link' -import '../../../features/header-footer-react' diff --git a/services/web/frontend/js/shared/context/user-context.tsx b/services/web/frontend/js/shared/context/user-context.tsx index 598455a5a9..9ea7e8daa8 100644 --- a/services/web/frontend/js/shared/context/user-context.tsx +++ b/services/web/frontend/js/shared/context/user-context.tsx @@ -1,10 +1,8 @@ import { createContext, FC, useContext, useMemo } from 'react' import getMeta from '../../utils/meta' -import { LoggedOutUser, User } from '../../../../types/user' +import { User } from '../../../../types/user' -export const UserContext = createContext( - undefined -) +export const UserContext = createContext(undefined) export const UserProvider: FC = ({ children }) => { const user = useMemo(() => getMeta('ol-user'), []) diff --git a/services/web/frontend/js/utils/meta.ts b/services/web/frontend/js/utils/meta.ts index 1f17c2057a..7ffe3ef86c 100644 --- a/services/web/frontend/js/utils/meta.ts +++ b/services/web/frontend/js/utils/meta.ts @@ -1,4 +1,4 @@ -import { User, Features, LoggedOutUser } from '../../../types/user' +import { User, Features } from '../../../types/user' import { User as MinimalUser } from '../../../types/admin/user' import { User as ManagedUser } from '../../../types/group-management/user' import { UserSettings } from '../../../types/user-settings' @@ -204,7 +204,7 @@ export interface Meta { 'ol-usGovBannerVariant': USGovBannerVariant 'ol-useShareJsHash': boolean 'ol-usedLatex': 'never' | 'occasionally' | 'often' | undefined - 'ol-user': User | LoggedOutUser + 'ol-user': User 'ol-userAffiliations': Affiliation[] 'ol-userCanExtendTrial': boolean 'ol-userCanNotStartRequestedTrial': boolean diff --git a/services/web/types/user.ts b/services/web/types/user.ts index 740fef75a1..1ecd6cdb2e 100644 --- a/services/web/types/user.ts +++ b/services/web/types/user.ts @@ -46,20 +46,4 @@ export type User = { } } -export type LoggedOutUser = { - id: null - email?: undefined - first_name?: undefined - last_name?: undefined - signUpDate?: undefined - labsProgram?: boolean - alphaProgram?: boolean - betaProgram?: boolean - allowedFreeTrial?: boolean - features?: Features - refProviders?: RefProviders - writefull?: undefined - isAdmin?: boolean -} - export type MongoUser = Pick> & { _id: string }