From 3b2e60ece78684857bbabff8e7c0dcc023bfeb0c Mon Sep 17 00:00:00 2001 From: Tim Down <158919+timdown@users.noreply.github.com> Date: Wed, 29 May 2024 11:06:20 +0100 Subject: [PATCH] Merge pull request #18558 from overleaf/td-bs5-query-string-override Add a mechanism to hide incomplete Bootstrap 5 pages by default GitOrigin-RevId: 07cc998bf3a0bed9df2f43d1c04c62d167c9b893 --- services/web/app/src/infrastructure/ExpressLocals.js | 6 ++++++ services/web/app/views/layout-base.pug | 4 ++-- services/web/app/views/project/list-react.pug | 4 +--- services/web/app/views/user/settings.pug | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 4ef57eca62..2e14ba6c02 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -338,6 +338,12 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) { next() }) + webRouter.use(function (req, res, next) { + res.locals.bootstrap5Override = + req.query['bootstrap-5-override'] === 'enabled' + next() + }) + webRouter.use(function (req, res, next) { res.locals.ExposedSettings = { isOverleaf: Settings.overleaf != null, diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index 2471639f27..337c449c58 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -6,7 +6,7 @@ html( class=(fixedSizeDocument ? 'fixed-size-document' : undefined) ) - metadata = metadata || {} - - let bootstrap5EnabledPage = false + - let bootstrap5PageStatus = 'disabled' // One of 'disabled', 'enabled', and 'queryStringOnly' block entrypointVar @@ -15,7 +15,7 @@ html( head include ./_metadata.pug - - const bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3 + - const bootstrapVersion = bootstrap5PageStatus !== 'disabled' && (bootstrap5Override || (bootstrap5PageStatus === 'enabled' && splitTestVariants['bootstrap-5'] === 'enabled')) ? 5 : 3 //- Stylesheet link(rel='stylesheet', href=buildCssPath(getCssThemeModifier(userSettings, brandVariation), bootstrapVersion), id="main-stylesheet") diff --git a/services/web/app/views/project/list-react.pug b/services/web/app/views/project/list-react.pug index e477725d05..cb55289c61 100644 --- a/services/web/app/views/project/list-react.pug +++ b/services/web/app/views/project/list-react.pug @@ -5,9 +5,7 @@ block entrypointVar block vars - var suppressNavContentLinks = true - -block vars - - bootstrap5EnabledPage = true + - bootstrap5PageStatus = 'queryStringOnly' // One of 'disabled', 'enabled', and 'queryStringOnly' block append meta meta(name="ol-usersBestSubscription" data-type="json" content=usersBestSubscription) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index 571e37e73b..6a7179a393 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -4,7 +4,7 @@ block entrypointVar - entrypoint = 'pages/user/settings' block vars - - bootstrap5EnabledPage = true + - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' block append meta meta(name="ol-hasPassword" data-type="boolean" content=hasPassword)