mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +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:
@@ -1628,6 +1628,22 @@ describe('ProjectController', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('should set showAiFeatures to false when the user has read-only access', async function (ctx) {
|
||||
ctx.PermissionsManager.promises.checkUserPermissions.resolves(true)
|
||||
ctx.AuthorizationManager.promises.getPrivilegeLevelForProject.resolves(
|
||||
'readOnly'
|
||||
)
|
||||
await new Promise((resolve, reject) => {
|
||||
ctx.res.render = (pageName, opts) => {
|
||||
expect(opts.showAiFeatures).to.equal(false)
|
||||
resolve()
|
||||
}
|
||||
ctx.ProjectController.loadEditor(ctx.req, ctx.res, err => {
|
||||
if (err) reject(err)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('should set showAiFeatures to false when the user can use ai but the project disallows it', async function (ctx) {
|
||||
ctx.PermissionsManager.promises.checkUserPermissions.callsFake(
|
||||
subject => Promise.resolve(typeof subject !== 'string')
|
||||
@@ -1760,6 +1776,23 @@ describe('ProjectController', function () {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('should set showAiFeatures to false and showAiFeaturesDisabled to false when the user has read-only access', async function (ctx) {
|
||||
ctx.PermissionsManager.promises.checkUserPermissions.resolves(true)
|
||||
ctx.AuthorizationManager.promises.getPrivilegeLevelForProject.resolves(
|
||||
'readOnly'
|
||||
)
|
||||
await new Promise((resolve, reject) => {
|
||||
ctx.res.render = (pageName, opts) => {
|
||||
expect(opts.showAiFeatures).to.equal(false)
|
||||
expect(opts.showAiFeaturesDisabled).to.equal(false)
|
||||
resolve()
|
||||
}
|
||||
ctx.ProjectController.loadEditor(ctx.req, ctx.res, err => {
|
||||
if (err) reject(err)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user