Skip to content
Snippets Groups Projects
Unverified Commit 67355659 authored by Kevin Aleman's avatar Kevin Aleman Committed by GitHub
Browse files

[FIX] Omnichannel inquiries being updated even if not needed (#26692)

parent df8b9dc0
No related branches found
No related tags found
No related merge requests found
......@@ -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 } },
);
}
}
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment