From 3f1edfc1c945dfba47cc856f16925d247c938d09 Mon Sep 17 00:00:00 2001
From: Liangjun Song <146005915+adai26@users.noreply.github.com>
Date: Fri, 23 Aug 2024 12:48:24 +0100
Subject: [PATCH] Merge pull request #19954 from
overleaf/ls-access-token-gradual-rollout-cleanup
Update git bridge modal for pw auth deprecation
GitOrigin-RevId: 2e764922bf350ddcba29bf9f3baa220ed1f48e40
---
.../src/Features/Project/ProjectController.js | 15 ++------
.../src/Features/User/UserPagesController.js | 34 +++++--------------
.../web/app/views/project/editor/meta.pug | 3 +-
services/web/app/views/user/settings.pug | 2 --
.../web/frontend/extracted-translations.json | 5 ++-
.../settings/components/linking-section.tsx | 10 ++----
services/web/frontend/js/utils/meta.ts | 2 --
.../stories/settings/helpers/linking.js | 1 -
.../stylesheets/modules/git-bridge-modal.less | 4 +++
services/web/locales/da.json | 1 -
services/web/locales/de.json | 1 -
services/web/locales/en.json | 5 ++-
services/web/locales/zh-CN.json | 1 -
.../editor-left-menu.spec.tsx | 2 +-
14 files changed, 27 insertions(+), 59 deletions(-)
diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js
index b339263091..be1b95eb66 100644
--- a/services/web/app/src/Features/Project/ProjectController.js
+++ b/services/web/app/src/Features/Project/ProjectController.js
@@ -333,7 +333,6 @@ const _ProjectController = {
'pdf-caching-prefetching',
'pdf-presentation-mode',
'pdfjs-40',
- 'personal-access-token',
'revert-file',
'revert-project',
'review-panel-redesign',
@@ -343,6 +342,7 @@ const _ProjectController = {
'ieee-stylesheet',
'write-and-cite',
'default-visual-for-beginners',
+ 'password-authentication-removal',
].filter(Boolean)
const getUserValues = async userId =>
@@ -635,16 +635,6 @@ const _ProjectController = {
!userIsMemberOfGroupSubscription &&
!userHasInstitutionLicence
- const showPersonalAccessToken =
- userId &&
- (!Features.hasFeature('saas') ||
- req.query?.personal_access_token === 'true')
-
- const optionalPersonalAccessToken =
- userId &&
- !showPersonalAccessToken &&
- splitTestAssignments['personal-access-token'].variant === 'enabled' // `?personal-access-token=enabled`
-
let showAiErrorAssistant = false
if (userId && Features.hasFeature('saas')) {
try {
@@ -751,8 +741,6 @@ const _ProjectController = {
showUpgradePrompt,
fixedSizeDocument: true,
useOpenTelemetry: Settings.useOpenTelemetryClient,
- showPersonalAccessToken,
- optionalPersonalAccessToken,
hasTrackChangesFeature: Features.hasFeature('track-changes'),
projectTags,
linkSharingWarning: linkSharingChanges.variant === 'active',
@@ -762,6 +750,7 @@ const _ProjectController = {
'enabled'
? usedLatex
: null,
+ isSaas: Features.hasFeature('saas'),
})
timer.done()
} catch (err) {
diff --git a/services/web/app/src/Features/User/UserPagesController.js b/services/web/app/src/Features/User/UserPagesController.js
index 78cd7e8f56..5552dad769 100644
--- a/services/web/app/src/Features/User/UserPagesController.js
+++ b/services/web/app/src/Features/User/UserPagesController.js
@@ -71,20 +71,6 @@ async function settingsPage(req, res) {
)
}
- const showPersonalAccessToken =
- !Features.hasFeature('saas') || req.query?.personal_access_token === 'true'
-
- // if not already enabled, use a split test to determine whether to offer personal access tokens
- let optionalPersonalAccessToken = false
- if (!showPersonalAccessToken) {
- const { variant } = await SplitTestHandler.promises.getAssignment(
- req,
- res,
- 'personal-access-token'
- )
- optionalPersonalAccessToken = variant === 'enabled' // `?personal-access-token=enabled`
- }
-
// getAssignment sets res.locals, which will pass to the splitTest context
await SplitTestHandler.promises.getAssignment(
req,
@@ -93,16 +79,14 @@ async function settingsPage(req, res) {
)
let personalAccessTokens
- if (showPersonalAccessToken || optionalPersonalAccessToken) {
- try {
- // require this here because module may not be included in some versions
- const PersonalAccessTokenManager = require('../../../../modules/oauth2-server/app/src/OAuthPersonalAccessTokenManager')
- personalAccessTokens = await PersonalAccessTokenManager.listTokens(
- user._id
- )
- } catch (error) {
- logger.error(OError.tag(error))
- }
+ try {
+ const results = await Modules.promises.hooks.fire(
+ 'listPersonalAccessTokens',
+ user._id
+ )
+ personalAccessTokens = results?.[0] ?? []
+ } catch (error) {
+ logger.error(OError.tag(error))
}
let currentManagedUserAdminEmail
@@ -189,8 +173,6 @@ async function settingsPage(req, res) {
ssoErrorMessage,
thirdPartyIds: UserPagesController._restructureThirdPartyIds(user),
projectSyncSuccessMessage,
- showPersonalAccessToken,
- optionalPersonalAccessToken,
personalAccessTokens,
emailAddressLimit: Settings.emailAddressLimit,
isManagedAccount: !!req.managedBy,
diff --git a/services/web/app/views/project/editor/meta.pug b/services/web/app/views/project/editor/meta.pug
index 83f36d4f12..f32800531f 100644
--- a/services/web/app/views/project/editor/meta.pug
+++ b/services/web/app/views/project/editor/meta.pug
@@ -31,14 +31,13 @@ meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
meta(name="ol-useOpenTelemetry" data-type="boolean" content=useOpenTelemetry)
meta(name="ol-showSupport", data-type="boolean" content=showSupport)
meta(name="ol-showTemplatesServerPro", data-type="boolean" content=showTemplatesServerPro)
-meta(name="ol-showPersonalAccessToken", data-type="boolean" content=showPersonalAccessToken)
-meta(name="ol-optionalPersonalAccessToken", data-type="boolean" content=optionalPersonalAccessToken)
meta(name="ol-hasTrackChangesFeature", data-type="boolean" content=hasTrackChangesFeature)
meta(name="ol-inactiveTutorials", data-type="json" content=user.inactiveTutorials)
meta(name="ol-projectTags" data-type="json" content=projectTags)
meta(name="ol-linkSharingWarning" data-type="boolean" content=linkSharingWarning)
meta(name="ol-usedLatex" data-type="string" content=usedLatex)
meta(name="ol-ro-mirror-on-client-no-local-storage" data-type="boolean" content=roMirrorOnClientNoLocalStorage)
+meta(name="ol-isSaas" data-type="boolean" content=isSaas)
// translations for the loading page, before i18n has loaded in the client
meta(name="ol-loadingText", data-type="string" content=translate("loading"))
diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug
index e0584ac3cf..28bd7633bc 100644
--- a/services/web/app/views/user/settings.pug
+++ b/services/web/app/views/user/settings.pug
@@ -26,8 +26,6 @@ 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)
- meta(name="ol-optionalPersonalAccessToken", data-type="boolean" content=optionalPersonalAccessToken)
meta(name="ol-personalAccessTokens", data-type="json" content=personalAccessTokens)
meta(name="ol-emailAddressLimit", data-type="json", content=emailAddressLimit)
meta(name="ol-currentManagedUserAdminEmail" data-type="string" content=currentManagedUserAdminEmail)
diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json
index bf77bdb9f6..971b53a52a 100644
--- a/services/web/frontend/extracted-translations.json
+++ b/services/web/frontend/extracted-translations.json
@@ -506,9 +506,12 @@
"git_bridge_modal_description": "",
"git_bridge_modal_enter_authentication_token": "",
"git_bridge_modal_git_authentication_tokens": "",
+ "git_bridge_modal_git_clone_your_project": "",
+ "git_bridge_modal_learn_more_about_authentication_tokens": "",
+ "git_bridge_modal_need_to_generate_an_authentication_token": "",
"git_bridge_modal_read_only": "",
"git_bridge_modal_see_once": "",
- "git_bridge_modal_tokens_description": "",
+ "git_bridge_modal_the_way_you_clone_projects_has_changed": "",
"git_bridge_modal_use_previous_token": "",
"git_bridge_modal_you_can_also_git_clone": "",
"git_integration": "",
diff --git a/services/web/frontend/js/features/settings/components/linking-section.tsx b/services/web/frontend/js/features/settings/components/linking-section.tsx
index 8781d38871..5a01806177 100644
--- a/services/web/frontend/js/features/settings/components/linking-section.tsx
+++ b/services/web/frontend/js/features/settings/components/linking-section.tsx
@@ -44,13 +44,9 @@ function LinkingSection() {
const renderSyncSection =
getMeta('ol-isSaas') || getMeta('ol-gitBridgeEnabled')
- const showPersonalAccessTokenComponents =
- getMeta('ol-showPersonalAccessToken') ||
- getMeta('ol-optionalPersonalAccessToken')
-
- const allIntegrationLinkingWidgets = showPersonalAccessTokenComponents
- ? integrationLinkingWidgets.concat(oauth2ServerComponents)
- : integrationLinkingWidgets
+ const allIntegrationLinkingWidgets = integrationLinkingWidgets.concat(
+ oauth2ServerComponents
+ )
// currently the only thing that is in the langFeedback section is writefull,
// which is behind a split test. we should hide this section if the user is not in the split test
diff --git a/services/web/frontend/js/utils/meta.ts b/services/web/frontend/js/utils/meta.ts
index 8f7d2f0b5d..9322d21fd2 100644
--- a/services/web/frontend/js/utils/meta.ts
+++ b/services/web/frontend/js/utils/meta.ts
@@ -141,7 +141,6 @@ export interface Meta {
'ol-notifications': NotificationType[]
'ol-notificationsInstitution': InstitutionType[]
'ol-oauthProviders': OAuthProviders
- 'ol-optionalPersonalAccessToken': boolean
'ol-overallThemes': OverallThemeMeta[]
'ol-passwordStrengthOptions': PasswordStrengthOptions
'ol-personalAccessTokens': AccessToken[] | undefined
@@ -174,7 +173,6 @@ export interface Meta {
'ol-showGroupsAndEnterpriseBanner': boolean
'ol-showInrGeoBanner': boolean
'ol-showLATAMBanner': boolean
- 'ol-showPersonalAccessToken': boolean
'ol-showSupport': boolean
'ol-showSymbolPalette': boolean
'ol-showTemplatesServerPro': boolean
diff --git a/services/web/frontend/stories/settings/helpers/linking.js b/services/web/frontend/stories/settings/helpers/linking.js
index 3ffc3a2c5f..de2733393f 100644
--- a/services/web/frontend/stories/settings/helpers/linking.js
+++ b/services/web/frontend/stories/settings/helpers/linking.js
@@ -75,5 +75,4 @@ export function setPersonalAccessTokensMeta() {
}
window.metaAttributesCache.set('ol-personalAccessTokens', tokens)
- window.metaAttributesCache.set('ol-showPersonalAccessToken', true)
}
diff --git a/services/web/frontend/stylesheets/modules/git-bridge-modal.less b/services/web/frontend/stylesheets/modules/git-bridge-modal.less
index 898dfe03ed..26b454dfcf 100644
--- a/services/web/frontend/stylesheets/modules/git-bridge-modal.less
+++ b/services/web/frontend/stylesheets/modules/git-bridge-modal.less
@@ -31,3 +31,7 @@
.git-bridge-optional-tokens-actions {
margin-top: @margin-sm;
}
+
+.git-bridge-modal-notification {
+ margin-bottom: @margin-sm;
+}
diff --git a/services/web/locales/da.json b/services/web/locales/da.json
index b09b22d31e..04ace13fa8 100644
--- a/services/web/locales/da.json
+++ b/services/web/locales/da.json
@@ -528,7 +528,6 @@
"git_bridge_modal_description": "Du kan git clone dit projekt med linket herunder.",
"git_bridge_modal_enter_authentication_token": "Når du bliver spurgt om en kode, indtast da din nye autentificeringsnøgle:",
"git_bridge_modal_see_once": "Du kan kun se denne autentificeringsnøgle én gang. For at slette den eller generere en ny, gå til dine brugerindstilinger. For detalerede instruktioner og fejlsøgning, læs vores <0>hjælpeside0>.",
- "git_bridge_modal_tokens_description": "For at git clone dit projekt har du brug for linket herunder og en git autentificeringsnøgle.",
"git_bridge_modal_use_previous_token": "Hvis du bliver spurgt om en kode kan du bruge en tidligere genereret autentificeringsnøgle. Du kan også generere en ny i dine kontoindstillinger. For mere hjælp, læs vores <0>hjælpeside0>.",
"git_integration": "Git-integration",
"git_integration_info": "Med Git-integration kan du klone dine Overleaf projekter med Git. For komplette instruktioner til hvordan du gør det, læs vores <0>hjælpeside0>.",
diff --git a/services/web/locales/de.json b/services/web/locales/de.json
index 3ccc0dfd1e..4daf26cc4e 100644
--- a/services/web/locales/de.json
+++ b/services/web/locales/de.json
@@ -533,7 +533,6 @@
"git_bridge_modal_description": "Du kannst git clone für dein Projekt über den unten angezeigten Link ausführen.",
"git_bridge_modal_enter_authentication_token": "Wenn Du nach einem Passwort gefragt wirst, gib deinen neuen Anmeldungs-Token ein:",
"git_bridge_modal_see_once": "Du siehst diesen Token nur einmal. Um ihn zu löschen oder einen weiteren zu generieren, besuche die Kontoeinstellungen. Für detaillierte Anweisungen und Problembehebung, besuche unsere <0>Hilfe-Seite0>.",
- "git_bridge_modal_tokens_description": "Um einen Git-Clone deines Projekts zu erstellen, benutze folgenden Link und einen Git-Anmeldungs-Token.",
"git_bridge_modal_use_previous_token": "Wenn Du nach einem Passwort gefragt wirst, kannst Du einen zuvor generierten Git-Anmeldungs-Token verwenden. Oder Du kannst einen Neuen in den Kontoeinstellungen generieren. Für mehr Hilfe, besuche unsere <0>Hilfe-Seite0>.",
"git_integration": "Git-Integration",
"git_integration_info": "Mit der Git-Integration kannst Du Overleaf-Projekte Git-clonen. Für weitere Anweisungen hierfür, besuche <0>unsere Hilfe-Seite0>.",
diff --git a/services/web/locales/en.json b/services/web/locales/en.json
index c7be9a968c..6c30af4dfe 100644
--- a/services/web/locales/en.json
+++ b/services/web/locales/en.json
@@ -753,9 +753,12 @@
"git_bridge_modal_description": "You can git clone your project using the link displayed below.",
"git_bridge_modal_enter_authentication_token": "When prompted for a password, enter your new authentication token:",
"git_bridge_modal_git_authentication_tokens": "Git authentication tokens",
+ "git_bridge_modal_git_clone_your_project": "Git clone your project by using the link below and a Git authentication token",
+ "git_bridge_modal_learn_more_about_authentication_tokens": "Learn more about Git integration authentication tokens.",
+ "git_bridge_modal_need_to_generate_an_authentication_token": "Instead of a password, you’ll need to generate an authentication token.",
"git_bridge_modal_read_only": "You have read-only access to this project. This means you can pull from __appName__ but you can’t push any changes you make back to this project.",
"git_bridge_modal_see_once": "You’ll only see this token once. To delete it or generate a new one, visit Account Settings. For detailed instructions and troubleshooting, read our <0>help page0>.",
- "git_bridge_modal_tokens_description": "To git clone your project you’ll need the link below and a Git authentication token.",
+ "git_bridge_modal_the_way_you_clone_projects_has_changed": "The way you git clone projects on Overleaf has changed.",
"git_bridge_modal_use_previous_token": "If you’re prompted for a password, you can use a previously generated Git authentication token. Or you can generate a new one in Account Settings. For more support, read our <0>help page0>.",
"git_bridge_modal_you_can_also_git_clone": "You can also git clone your project by using the link below and a Git authentication token.",
"git_gitHub_dropbox_mendeley_and_zotero_integrations": "Git, GitHub, Dropbox, Mendeley, and Zotero integrations",
diff --git a/services/web/locales/zh-CN.json b/services/web/locales/zh-CN.json
index 3d1dd8bd43..098eb56ef8 100644
--- a/services/web/locales/zh-CN.json
+++ b/services/web/locales/zh-CN.json
@@ -718,7 +718,6 @@
"git_bridge_modal_git_authentication_tokens": "Git 身份验证令牌",
"git_bridge_modal_read_only": "您对此项目具有只读访问权限这意味着您可以从__appName__中提取,但不能将您所做的任何更改推送回该项目。",
"git_bridge_modal_see_once": "您只能看到此令牌一次。要删除或生成新帐户,请访问“帐户设置”。有关详细说明和故障排除,请阅读我们的<0>帮助页面0>。",
- "git_bridge_modal_tokens_description": "要用 git 克隆您的项目,您需要下面的链接和 git 身份验证令牌。",
"git_bridge_modal_use_previous_token": "如果系统提示您输入密码,您可以使用以前生成的Git身份验证令牌。或者,您可以在“帐户设置”中生成一个新帐户。有关更多支持,请阅读我们的<0>帮助页面0>。",
"git_bridge_modal_you_can_also_git_clone": "您也可以使用下面的链接和git身份验证令牌来git克隆您的项目。",
"git_gitHub_dropbox_mendeley_and_zotero_integrations": "Git、GitHub、Dropbox、Mendeley 和 Zotero 集成",
diff --git a/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx b/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx
index 2c9ca2c308..b368769bbe 100644
--- a/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx
+++ b/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx
@@ -267,7 +267,7 @@ describe('', function () {
cy.findByRole('button', { name: 'Git' }).click()
cy.findByText('Clone with Git')
- cy.findByText(/your project using the link displayed below/)
+ cy.findByText(/clone your project by using the link below/)
})
it('shows git modal paywall correctly', function () {