mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 13:21:37 +02:00
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:
committed by
Copybot
parent
df8190ec8c
commit
551d7b3908
@@ -3,21 +3,26 @@ import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
|
||||
import { scriptRunner } from '../lib/ScriptRunner.mjs'
|
||||
|
||||
async function main(trackProgress) {
|
||||
// update all applicable user models
|
||||
// Set aiFeatures.enabled to false where writefull.enabled is false
|
||||
await batchedUpdate(
|
||||
db.users,
|
||||
{
|
||||
'writefull.enabled': false,
|
||||
},
|
||||
{
|
||||
$set: {
|
||||
'aiErrorAssistant.enabled': false,
|
||||
},
|
||||
},
|
||||
{ 'writefull.enabled': false },
|
||||
{ $set: { 'aiFeatures.enabled': false } },
|
||||
undefined,
|
||||
undefined,
|
||||
{ trackProgress }
|
||||
)
|
||||
|
||||
// Set aiFeatures.enabled to true for all other cases (true, null, or not exists)
|
||||
await batchedUpdate(
|
||||
db.users,
|
||||
{ 'writefull.enabled': { $ne: false } },
|
||||
{ $set: { 'aiFeatures.enabled': true } },
|
||||
undefined,
|
||||
undefined,
|
||||
{ trackProgress }
|
||||
)
|
||||
|
||||
console.log('completed syncing writefull state with error assist')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user