Merge pull request #21212 from overleaf/revert-20969-ac-subscription-layout-react

Revert "[web] Set Subscription pages to have `layout-react`"

GitOrigin-RevId: eaf3a651160e278adcb103864c5ea81ea3e35aa7
This commit is contained in:
Eric Mc Sween 2024-10-17 14:07:48 -04:00 committed by Copybot
parent 2c7530a6cf
commit b2d991d74a
14 changed files with 11 additions and 41 deletions

View file

@ -1,12 +1,6 @@
const _ = require('lodash') const _ = require('lodash')
/** @typedef {import('../../../../types/user').User} User */
const SessionManager = { const SessionManager = {
/**
* @param session
* @returns {User | null}
*/
getSessionUser(session) { getSessionUser(session) {
const sessionUser = _.get(session, ['user']) const sessionUser = _.get(session, ['user'])
const sessionPassportUser = _.get(session, ['passport', 'user']) const sessionPassportUser = _.get(session, ['passport', 'user'])

View file

@ -169,16 +169,12 @@ async function viewInvite(req, res, next) {
invite.email invite.email
) )
/** @type {import('../../../../types/user').LoggedOutUser} */
const userWithoutSensitiveFields = { id: null }
return res.render('subscriptions/team/invite_logged_out', { return res.render('subscriptions/team/invite_logged_out', {
inviterName: invite.inviterName, inviterName: invite.inviterName,
inviteToken: invite.token, inviteToken: invite.token,
appName: settings.appName, appName: settings.appName,
accountExists: userByEmail != null, accountExists: userByEmail != null,
emailAddress: invite.email, emailAddress: invite.email,
userWithoutSensitiveFields,
}) })
} }
} }

View file

@ -37,7 +37,6 @@ block append meta
subdomainLang: settings.i18n.subdomainLang, subdomainLang: settings.i18n.subdomainLang,
translatedLanguages: settings.translatedLanguages translatedLanguages: settings.translatedLanguages
}) })
meta(name="ol-user" data-type="json" content=(userWithoutSensitiveFields || getSessionUser()))
block body block body
if (typeof suppressNavbar === "undefined") if (typeof suppressNavbar === "undefined")

View file

@ -1,4 +1,4 @@
extends ../layout-react extends ../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../layout-react extends ../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../layout-react extends ../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../../layout-react extends ../../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../../layout-react extends ../../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../../layout-react extends ../../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -1,4 +1,4 @@
extends ../../layout-react extends ../../layout-marketing
block vars block vars
- bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly'

View file

@ -6,4 +6,3 @@ import '../../../features/contact-form'
import '../../../features/event-tracking' import '../../../features/event-tracking'
import '../../../features/cookie-banner' import '../../../features/cookie-banner'
import '../../../features/link-helpers/slow-link' import '../../../features/link-helpers/slow-link'
import '../../../features/header-footer-react'

View file

@ -1,10 +1,8 @@
import { createContext, FC, useContext, useMemo } from 'react' import { createContext, FC, useContext, useMemo } from 'react'
import getMeta from '../../utils/meta' import getMeta from '../../utils/meta'
import { LoggedOutUser, User } from '../../../../types/user' import { User } from '../../../../types/user'
export const UserContext = createContext<User | LoggedOutUser | undefined>( export const UserContext = createContext<User | undefined>(undefined)
undefined
)
export const UserProvider: FC = ({ children }) => { export const UserProvider: FC = ({ children }) => {
const user = useMemo(() => getMeta('ol-user'), []) const user = useMemo(() => getMeta('ol-user'), [])

View file

@ -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 MinimalUser } from '../../../types/admin/user'
import { User as ManagedUser } from '../../../types/group-management/user' import { User as ManagedUser } from '../../../types/group-management/user'
import { UserSettings } from '../../../types/user-settings' import { UserSettings } from '../../../types/user-settings'
@ -204,7 +204,7 @@ export interface Meta {
'ol-usGovBannerVariant': USGovBannerVariant 'ol-usGovBannerVariant': USGovBannerVariant
'ol-useShareJsHash': boolean 'ol-useShareJsHash': boolean
'ol-usedLatex': 'never' | 'occasionally' | 'often' | undefined 'ol-usedLatex': 'never' | 'occasionally' | 'often' | undefined
'ol-user': User | LoggedOutUser 'ol-user': User
'ol-userAffiliations': Affiliation[] 'ol-userAffiliations': Affiliation[]
'ol-userCanExtendTrial': boolean 'ol-userCanExtendTrial': boolean
'ol-userCanNotStartRequestedTrial': boolean 'ol-userCanNotStartRequestedTrial': boolean

View file

@ -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<User, Exclude<keyof User, 'id'>> & { _id: string } export type MongoUser = Pick<User, Exclude<keyof User, 'id'>> & { _id: string }