mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
[saas-e2e] adjust project name for new SpamSafe limits (#27875)
* [saas-e2e] adjust project name for new SpamSafe limits * [saas-e2e] stay below 6 digits for spam safe project name Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com> --------- Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com> GitOrigin-RevId: 77c039312c01b33aeb3b57661ec6ca5b88a0a36b
This commit is contained in:
@@ -132,6 +132,17 @@ export function shareProjectByEmailAndAcceptInviteViaDash(
|
||||
openProjectViaInviteNotification(projectName)
|
||||
}
|
||||
|
||||
export function getSpamSafeProjectName() {
|
||||
while (true) {
|
||||
// Move from hex/16 to base64/64 possible characters per char in string
|
||||
const name = Buffer.from(uuid().replaceAll('-', ''), 'hex')
|
||||
.toString('base64')
|
||||
.slice(0, 10)
|
||||
const nDigits = (name.match(/\d/g) || []).length
|
||||
if (nDigits < 6) return name
|
||||
}
|
||||
}
|
||||
|
||||
export function shareProjectByEmailAndAcceptInviteViaEmail(
|
||||
projectName: string,
|
||||
email: string,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ensureUserExists, login } from './helpers/login'
|
||||
import {
|
||||
createProject,
|
||||
enableLinkSharing,
|
||||
getSpamSafeProjectName,
|
||||
openProjectByName,
|
||||
openProjectViaLinkSharingAsAnon,
|
||||
openProjectViaLinkSharingAsUser,
|
||||
@@ -20,7 +21,7 @@ describe('Project Sharing', function () {
|
||||
|
||||
let projectName: string
|
||||
beforeWithReRunOnTestRetry(function () {
|
||||
projectName = `Project ${uuid()}`
|
||||
projectName = getSpamSafeProjectName()
|
||||
setupTestProject()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user