diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 497927a6c9..934653ecd2 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -1317,6 +1317,10 @@ const ProjectController = { onboardingVideoTourAssignment.variant === 'active' && req.session.justRegistered + const showPersonalAccessToken = + !Features.hasFeature('saas') || + req.query?.personal_access_token === 'true' + const template = detachRole === 'detached' ? 'project/editor_detached' @@ -1407,6 +1411,7 @@ const ProjectController = { richTextVariant: richTextAssignment.variant, showOnboardingVideoTour, historyViewReact: historyViewAssignment.variant === 'react', + showPersonalAccessToken, }) timer.done() } diff --git a/services/web/app/src/Features/User/UserPagesController.js b/services/web/app/src/Features/User/UserPagesController.js index 1e22f9e2fc..4b33e60458 100644 --- a/services/web/app/src/Features/User/UserPagesController.js +++ b/services/web/app/src/Features/User/UserPagesController.js @@ -8,6 +8,7 @@ const SessionManager = require('../Authentication/SessionManager') const NewsletterManager = require('../Newsletter/NewsletterManager') const _ = require('lodash') const { expressify } = require('../../util/promises') +const Features = require('../../infrastructure/Features') async function settingsPage(req, res) { const userId = SessionManager.getLoggedInUserId(req.session) @@ -64,6 +65,10 @@ async function settingsPage(req, res) { res.redirect('/') ) } + + const showPersonalAccessToken = + !Features.hasFeature('saas') || req.query?.personal_access_token === 'true' + res.render('user/settings', { title: 'account_settings', user: { @@ -106,6 +111,7 @@ async function settingsPage(req, res) { ssoErrorMessage, thirdPartyIds: UserPagesController._restructureThirdPartyIds(user), projectSyncSuccessMessage, + showPersonalAccessToken, }) } diff --git a/services/web/app/views/project/editor/meta.pug b/services/web/app/views/project/editor/meta.pug index d734416046..ecf9916230 100644 --- a/services/web/app/views/project/editor/meta.pug +++ b/services/web/app/views/project/editor/meta.pug @@ -41,6 +41,7 @@ meta(name="ol-showTemplatesServerPro", data-type="boolean" content=showTemplates meta(name="ol-showCM6SwitchAwaySurvey", data-type="boolean" content=showCM6SwitchAwaySurvey) meta(name="ol-richTextVariant" content=richTextVariant) meta(name="ol-showOnboardingVideoTour", data-type="boolean" content=showOnboardingVideoTour) +meta(name="ol-showPersonalAccessToken", data-type="boolean" content=showPersonalAccessToken) if (richTextVariant === 'cm6') meta(name="ol-mathJax3Path" content=mathJax3Path) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index dd5617b100..73fcc77bab 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -22,7 +22,7 @@ block append meta meta(name="ol-dropbox" data-type="json" content=dropbox) meta(name="ol-github" data-type="json" content=github) meta(name="ol-projectSyncSuccessMessage", content=projectSyncSuccessMessage) - + meta(name="ol-showPersonalAccessToken", data-type="boolean" content=showPersonalAccessToken) block content main.content.content-alt#settings-page-root diff --git a/services/web/test/unit/src/User/UserPagesControllerTests.js b/services/web/test/unit/src/User/UserPagesControllerTests.js index 2c94b3fb4a..8504ffe67b 100644 --- a/services/web/test/unit/src/User/UserPagesControllerTests.js +++ b/services/web/test/unit/src/User/UserPagesControllerTests.js @@ -67,6 +67,9 @@ describe('UserPagesController', function () { _getRedirectFromSession: sinon.stub(), setRedirectInSession: sinon.stub(), } + this.Features = { + hasFeature: sinon.stub().returns(false), + } this.UserPagesController = SandboxedModule.require(modulePath, { requires: { '@overleaf/settings': this.settings, @@ -76,6 +79,7 @@ describe('UserPagesController', function () { '../Errors/ErrorController': this.ErrorController, '../Authentication/AuthenticationController': this.AuthenticationController, + '../../infrastructure/Features': this.Features, '../Authentication/SessionManager': this.SessionManager, request: (this.request = sinon.stub()), },