fix(moveAsync): ZMS-215: fix incorrect existsEntries and removeEntries clearing in updateMessage() (#803)

* fix incorrect existsEntries and removeEntries clearing in updateMessage()

* add clarifying comment
This commit is contained in:
NickOvt 2025-04-07 11:40:53 +03:00 committed by GitHub
parent 04b2751f87
commit f0f35e1b67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -197,6 +197,7 @@ class MessageHandler {
// get target mailbox data
// get target user data
// if throws will be handled by caller or wrapper
let [mailboxData, userData] = await Promise.all([this.getMailboxAsync(options), this.users.collection('users').findOne({ _id: options.user })]);
if (!userData) {
@ -2201,8 +2202,8 @@ class MessageHandler {
this.notifier.addEntries(mailboxData, removeEntries, () => {
// mark messages as added to new mailbox
this.notifier.addEntries(targetData, existsEntries, () => {
removeEntries = [];
existsEntries = [];
removeEntries.length = 0; // Clear top-level argument array, setting length to 0 clears array object
existsEntries.length = 0;
this.notifier.fire(mailboxData.user);
return resolve(true);
});