[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:
Miguel Serrano
2026-09-17 11:17:38 +00:00
committed by Copybot
parent 69ccb3c316
commit 9394f64c54
4 changed files with 52 additions and 18 deletions
@@ -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)
})
})
})
})
})
})