diff --git a/apps/meteor/server/models/raw/LivechatInquiry.ts b/apps/meteor/server/models/raw/LivechatInquiry.ts index 23d1eea9bd985a6ddc016c012a77ea43dc156ab9..ea2d65953bf296c3081a146df2b2b016392ba092 100644 --- a/apps/meteor/server/models/raw/LivechatInquiry.ts +++ b/apps/meteor/server/models/raw/LivechatInquiry.ts @@ -87,6 +87,9 @@ export class LivechatInquiryRaw extends BaseRaw<ILivechatInquiryRecord> implemen } async unlockAll(): Promise<UpdateResult | Document> { - return this.updateMany({}, { $unset: { locked: 1, lockedAt: 1 } }); + return this.updateMany( + { $or: [{ lockedAt: { $exists: true } }, { locked: { $exists: true } }] }, + { $unset: { locked: 1, lockedAt: 1 } }, + ); } } diff --git a/apps/meteor/server/modules/listeners/listeners.module.ts b/apps/meteor/server/modules/listeners/listeners.module.ts index 2ca66ed5db11cc082ff657cf2a0698e0eebaf8c4..ec3225bde12c996f01a083cc0508519f807ce781 100644 --- a/apps/meteor/server/modules/listeners/listeners.module.ts +++ b/apps/meteor/server/modules/listeners/listeners.module.ts @@ -169,6 +169,17 @@ export class ListenersModule { }); } + // Don't do notifications for updating inquiries when the only thing changing is the queue metadata + if ( + clientAction === 'updated' && + diff?.hasOwnProperty('lockedAt') && + diff?.hasOwnProperty('locked') && + diff?.hasOwnProperty('_updatedAt') && + Object.keys(diff).length === 3 + ) { + return; + } + notifications.streamLivechatQueueData.emitWithoutBroadcast(inquiry._id, { ...inquiry, clientAction,