mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19108 from overleaf/jdt-ai-rm-alpha-reqs
Remove Alpha bypass for AI Error Correction GitOrigin-RevId: d6b93bc2071dbeeb3d67d48197e61abf4d920944
This commit is contained in:
parent
d16fee1afe
commit
d7863bec37
3 changed files with 14 additions and 7 deletions
|
@ -42,6 +42,8 @@ const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
|
||||||
const TagsHandler = require('../Tags/TagsHandler')
|
const TagsHandler = require('../Tags/TagsHandler')
|
||||||
const TutorialHandler = require('../Tutorial/TutorialHandler')
|
const TutorialHandler = require('../Tutorial/TutorialHandler')
|
||||||
const UserUpdater = require('../User/UserUpdater')
|
const UserUpdater = require('../User/UserUpdater')
|
||||||
|
const { checkUserPermissions } =
|
||||||
|
require('../Authorization/PermissionsManager').promises
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
|
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
|
||||||
|
@ -596,10 +598,19 @@ const _ProjectController = {
|
||||||
!showPersonalAccessToken &&
|
!showPersonalAccessToken &&
|
||||||
splitTestAssignments['personal-access-token'].variant === 'enabled' // `?personal-access-token=enabled`
|
splitTestAssignments['personal-access-token'].variant === 'enabled' // `?personal-access-token=enabled`
|
||||||
|
|
||||||
|
let canUseAi
|
||||||
|
try {
|
||||||
|
await checkUserPermissions(user, ['use-ai'])
|
||||||
|
canUseAi = true
|
||||||
|
} catch (err) {
|
||||||
|
canUseAi = false
|
||||||
|
}
|
||||||
|
|
||||||
const showAiErrorAssistant =
|
const showAiErrorAssistant =
|
||||||
userId &&
|
userId &&
|
||||||
Features.hasFeature('saas') &&
|
Features.hasFeature('saas') &&
|
||||||
(user.features?.aiErrorAssistant || user.alphaProgram) &&
|
user.features?.aiErrorAssistant &&
|
||||||
|
canUseAi &&
|
||||||
(privilegeLevel === PrivilegeLevels.READ_AND_WRITE ||
|
(privilegeLevel === PrivilegeLevels.READ_AND_WRITE ||
|
||||||
privilegeLevel === PrivilegeLevels.OWNER)
|
privilegeLevel === PrivilegeLevels.OWNER)
|
||||||
|
|
||||||
|
|
|
@ -509,6 +509,7 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
||||||
RateLimiterMiddleware.rateLimit(openProjectRateLimiter, {
|
RateLimiterMiddleware.rateLimit(openProjectRateLimiter, {
|
||||||
params: ['Project_id'],
|
params: ['Project_id'],
|
||||||
}),
|
}),
|
||||||
|
PermissionsController.useCapabilities(),
|
||||||
AuthorizationMiddleware.ensureUserCanReadProject,
|
AuthorizationMiddleware.ensureUserCanReadProject,
|
||||||
ProjectController.loadEditor
|
ProjectController.loadEditor
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,12 +3,7 @@ import { useUserContext } from '../../../shared/context/user-context'
|
||||||
|
|
||||||
function LabsProgramSection() {
|
function LabsProgramSection() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { labsProgram, alphaProgram } = useUserContext()
|
const { labsProgram } = useUserContext()
|
||||||
|
|
||||||
// keeping alpha only as we test AI experiment in preparation for general labs release
|
|
||||||
if (!alphaProgram) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const labsStatusText = labsProgram
|
const labsStatusText = labsProgram
|
||||||
? t('youre_a_member_of_overleaf_labs')
|
? t('youre_a_member_of_overleaf_labs')
|
||||||
|
|
Loading…
Reference in a new issue