From 956aad7e43739c13fa2418a0ee0ea79b2f12b300 Mon Sep 17 00:00:00 2001 From: Tim Down <158919+timdown@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:17:25 +0100 Subject: [PATCH] Merge pull request #18764 from overleaf/td-bs5-dashboard-feature-flag Create new feature flag for BS5 project dashboard page GitOrigin-RevId: a523bd7df94c411805ac2f5234135bc7a56d25bb --- .../Features/Project/ProjectListController.js | 11 ++++++++--- .../src/Features/User/UserPagesController.js | 5 +++-- services/web/app/views/layout-base.pug | 19 ++++++++++--------- services/web/app/views/project/list-react.pug | 3 ++- services/web/app/views/user/settings.pug | 1 + 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectListController.js b/services/web/app/src/Features/Project/ProjectListController.js index dd274bfe67..4144143844 100644 --- a/services/web/app/src/Features/Project/ProjectListController.js +++ b/services/web/app/src/Features/Project/ProjectListController.js @@ -424,9 +424,14 @@ async function projectListPage(req, res, next) { ) } - // Get the user's assignment for the Bootstrap 5 split test, which populates - // splitTestVariants with a value for 'bootstrap-5' and allows Pug to read it - await SplitTestHandler.promises.getAssignment(req, res, 'bootstrap-5') + // Get the user's assignment for this page's Bootstrap 5 split test, which + // populates splitTestVariants with a value for the split test name and allows + // Pug to read it + await SplitTestHandler.promises.getAssignment( + req, + res, + 'bootstrap-5-project-dashboard' + ) res.render('project/list-react', { title: 'your_projects', diff --git a/services/web/app/src/Features/User/UserPagesController.js b/services/web/app/src/Features/User/UserPagesController.js index 3a7fc52cd8..d5f106cf4e 100644 --- a/services/web/app/src/Features/User/UserPagesController.js +++ b/services/web/app/src/Features/User/UserPagesController.js @@ -138,8 +138,9 @@ async function settingsPage(req, res) { ) } - // Get the user's assignment for the Bootstrap 5 split test, which populates - // splitTestVariants with a value for 'bootstrap-5' and allows Pug to read it + // Get the user's assignment for this page's Bootstrap 5 split test, which + // populates splitTestVariants with a value for the split test name and allows + // Pug to read it await SplitTestHandler.promises.getAssignment(req, res, 'bootstrap-5') res.render('user/settings', { diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index e33ea57f7a..944435317e 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -7,6 +7,7 @@ html( ) - metadata = metadata || {} - let bootstrap5PageStatus = 'disabled' // One of 'disabled', 'enabled', and 'queryStringOnly' + - let bootstrap5PageSplitTest = '' block entrypointVar @@ -14,8 +15,8 @@ html( head include ./_metadata.pug - - - const bootstrapVersion = bootstrap5PageStatus !== 'disabled' && (bootstrap5Override || (bootstrap5PageStatus === 'enabled' && splitTestVariants['bootstrap-5'] === 'enabled')) ? 5 : 3 + + - const bootstrapVersion = bootstrap5PageStatus !== 'disabled' && (bootstrap5Override || (bootstrap5PageStatus === 'enabled' && splitTestVariants[bootstrap5PageSplitTest] === 'enabled')) ? 5 : 3 - const ieeeStylesheetEnabled = splitTestVariants?.['ieee-stylesheet'] !== 'disabled' //- Stylesheet @@ -26,17 +27,17 @@ html( block _headLinks - if (typeof(suppressRelAlternateLinks) == "undefined") + if (typeof suppressRelAlternateLinks == "undefined") if settings.i18n.subdomainLang each subdomainDetails in settings.i18n.subdomainLang if !subdomainDetails.hide - link(rel="alternate", href=subdomainDetails.url+currentUrl, hreflang=subdomainDetails.lngCode) - + link(rel="alternate", href=subdomainDetails.url + currentUrl, hreflang=subdomainDetails.lngCode) + if (entrypoint !== 'marketing') link(rel="preload", href=buildJsPath(currentLngCode + "-json.js"), as="script", nonce=scriptNonce) //- Scripts - if (typeof(suppressGoogleAnalytics) == "undefined") + if (typeof suppressGoogleAnalytics == "undefined") include _google_analytics block meta @@ -58,7 +59,7 @@ html( meta(name="ol-splitTestVariants" data-type="json" content=splitTestVariants || {}) meta(name="ol-splitTestInfo" data-type="json" content=splitTestInfo || {}) - if (typeof(settings.algolia) != "undefined") + if (typeof settings.algolia != "undefined") meta(name="ol-algolia" data-type="json" content={ appId: settings.algolia.app_id, apiKey: settings.algolia.read_only_api_key, @@ -74,9 +75,9 @@ html( body(class=(showThinFooter ? 'thin-footer' : undefined)) if(settings.recaptcha && settings.recaptcha.siteKeyV3) - script(type="text/javascript", nonce=scriptNonce, src="https://www.recaptcha.net/recaptcha/api.js?render="+settings.recaptcha.siteKeyV3, defer=deferScripts) + script(type="text/javascript", nonce=scriptNonce, src="https://www.recaptcha.net/recaptcha/api.js?render=" + settings.recaptcha.siteKeyV3, defer=deferScripts) - if (typeof(suppressSkipToContent) == "undefined") + if (typeof suppressSkipToContent == "undefined") a(class="skip-to-content" href="#main-content") #{translate('skip_to_content')} block body diff --git a/services/web/app/views/project/list-react.pug b/services/web/app/views/project/list-react.pug index bac242c186..7e40ab4e21 100644 --- a/services/web/app/views/project/list-react.pug +++ b/services/web/app/views/project/list-react.pug @@ -5,7 +5,8 @@ block entrypointVar block vars - var suppressNavContentLinks = true - - bootstrap5PageStatus = 'queryStringOnly' // One of 'disabled', 'enabled', and 'queryStringOnly' + - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' + - bootstrap5PageSplitTest = 'bootstrap-5-project-dashboard' 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 6a7179a393..0f444765e6 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -5,6 +5,7 @@ block entrypointVar block vars - bootstrap5PageStatus = 'enabled' // One of 'disabled', 'enabled', and 'queryStringOnly' + - bootstrap5PageSplitTest = 'bootstrap-5' block append meta meta(name="ol-hasPassword" data-type="boolean" content=hasPassword)