diff --git a/.changeset/gold-knives-sparkle.md b/.changeset/gold-knives-sparkle.md new file mode 100644 index 000000000000..144573944d49 --- /dev/null +++ b/.changeset/gold-knives-sparkle.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Fixes an issue where ignore threads parameter were not being affected by retention policy overriding in old channels diff --git a/apps/meteor/server/startup/migrations/index.ts b/apps/meteor/server/startup/migrations/index.ts index e7a18e836722..e7efdc89ebde 100644 --- a/apps/meteor/server/startup/migrations/index.ts +++ b/apps/meteor/server/startup/migrations/index.ts @@ -38,5 +38,6 @@ import './v301'; import './v303'; import './v304'; import './v305'; +import './v306'; export * from './xrun'; diff --git a/apps/meteor/server/startup/migrations/v306.ts b/apps/meteor/server/startup/migrations/v306.ts new file mode 100644 index 000000000000..fcd6ae9e3558 --- /dev/null +++ b/apps/meteor/server/startup/migrations/v306.ts @@ -0,0 +1,22 @@ +import { Rooms } from '@rocket.chat/models'; + +import { addMigration } from '../../lib/migrations'; + +addMigration({ + version: 306, + name: 'Adds missing ignoreThreads parameter for old rooms with retention policy overridden', + async up() { + await Rooms.updateMany( + { + 'retention.enabled': true, + 'retention.overrideGlobal': true, + 'retention.ignoreThreads': { $exists: false }, + }, + { + $set: { + 'retention.ignoreThreads': false, + }, + }, + ); + }, +});