feat: migrate from aiErrorAssist naming for disabling AI features to aiFeatures.enabled to avoid confusion (#31273)

feat: keep aiErrorAssistant as setting on user object until migration is run
GitOrigin-RevId: df53914163566065d0b91b8d130476fbcdf1ea96
This commit is contained in:
Jimmy Domagala-Tang
2026-02-12 09:38:27 -05:00
committed by Copybot
parent df8190ec8c
commit 551d7b3908
10 changed files with 40 additions and 28 deletions
@@ -168,7 +168,9 @@ async function projectListPage(req, res, next) {
const user = await User.findById(
userId,
`email isAdmin emails features alphaProgram betaProgram lastPrimaryEmailCheck lastActive signUpDate ace refProviders${
isSaas ? ' enrollment writefull completedTutorials aiErrorAssistant' : ''
isSaas
? ' enrollment writefull completedTutorials aiFeatures aiErrorAssistant'
: ''
}`
)
@@ -904,7 +906,11 @@ async function _userHasAIAssist(user) {
// It does NOT determine if the user has AI Assist enabled
async function _canUseAIAssist(user) {
// Check if the assistant has been manually disabled by the user
if (user.aiErrorAssistant?.enabled === false) {
// todo: assist clean-up: remove other case once migration finishes
if (
user.aiErrorAssistant?.enabled === false ||
user.aiFeatures?.enabled === false
) {
return false
}