diff --git a/apps/meteor/server/models/raw/LivechatInquiry.ts b/apps/meteor/server/models/raw/LivechatInquiry.ts index 703ddeafbaeb3..db70a888b385e 100644 --- a/apps/meteor/server/models/raw/LivechatInquiry.ts +++ b/apps/meteor/server/models/raw/LivechatInquiry.ts @@ -86,6 +86,9 @@ export class LivechatInquiryRaw extends BaseRaw implemen } async unlockAll(): Promise { - 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 722ba410c4d3c..794ff8c4d92ea 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,