Merge pull request #19238 from overleaf/jdt-use-ai-project-fix

feat: matching rename to checkPermissions within projectController
GitOrigin-RevId: ea05800c145858237fb0b236f9a19837c6c4a9a2
This commit is contained in:
Jimmy Domagala-Tang 2024-07-02 09:31:12 -04:00 committed by Copybot
parent 8abda70bfd
commit f77894c427
2 changed files with 4 additions and 2 deletions

View file

@ -450,9 +450,11 @@ module.exports = {
getUserRestrictions,
getUserValidationStatus: callbackify(getUserValidationStatus),
checkCollaboratorsPermission: callbackify(checkUserListPermissions),
checkUserPermissions: callbackify(checkUserPermissions),
promises: {
assertUserPermissions,
getUserValidationStatus,
checkUserListPermissions,
checkUserPermissions,
},
}

View file

@ -613,10 +613,10 @@ const _ProjectController = {
!showPersonalAccessToken &&
splitTestAssignments['personal-access-token'].variant === 'enabled' // `?personal-access-token=enabled`
// still allow users to access project if we cant get their permissions, but disable AI feature
let canUseAi
try {
await checkUserPermissions(user, ['use-ai'])
canUseAi = true
canUseAi = await checkUserPermissions(user, ['use-ai'])
} catch (err) {
canUseAi = false
}