mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
[web] Minor fixes for AI Disabled state (#34504)
* [web] Minor fixes for AI Disabled state - Applies opacity to disabled spark icons - Forces AI controls to be hidden on View state * Removed redundant check GitOrigin-RevId: a1389bec3e80a396c77a22294b1d921b4116a75c
This commit is contained in:
@@ -813,22 +813,25 @@ const _ProjectController = {
|
||||
|
||||
let aiFeaturesAllowedForUser = false
|
||||
let aiFeaturesAllowedForProject = false
|
||||
if (userId && Features.hasFeature('saas')) {
|
||||
|
||||
const canUserWriteOrReviewProjectContent =
|
||||
privilegeLevel === PrivilegeLevels.READ_AND_WRITE ||
|
||||
privilegeLevel === PrivilegeLevels.OWNER ||
|
||||
privilegeLevel === PrivilegeLevels.REVIEW
|
||||
|
||||
if (
|
||||
userId &&
|
||||
canUserWriteOrReviewProjectContent &&
|
||||
Features.hasFeature('saas')
|
||||
) {
|
||||
try {
|
||||
aiFeaturesAllowedForUser = await checkUserPermissions(user, [
|
||||
'use-ai',
|
||||
])
|
||||
|
||||
const canUserWriteOrReviewProjectContent =
|
||||
privilegeLevel === PrivilegeLevels.READ_AND_WRITE ||
|
||||
privilegeLevel === PrivilegeLevels.OWNER ||
|
||||
privilegeLevel === PrivilegeLevels.REVIEW
|
||||
if (canUserWriteOrReviewProjectContent) {
|
||||
aiFeaturesAllowedForProject = await checkUserPermissions(
|
||||
project.owner_ref,
|
||||
['use-ai']
|
||||
)
|
||||
}
|
||||
aiFeaturesAllowedForProject = await checkUserPermissions(
|
||||
project.owner_ref,
|
||||
['use-ai']
|
||||
)
|
||||
} catch (err) {
|
||||
// still allow users to access project if we cant get their permissions, but disable AI feature
|
||||
aiFeaturesAllowedForUser = false
|
||||
|
||||
Reference in New Issue
Block a user