Skip to content

Commit f0f35e1

Browse files
authored
fix(moveAsync): ZMS-215: fix incorrect existsEntries and removeEntries clearing in updateMessage() (#803)
* fix incorrect existsEntries and removeEntries clearing in updateMessage() * add clarifying comment
1 parent 04b2751 commit f0f35e1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/message-handler.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class MessageHandler {
197197

198198
// get target mailbox data
199199
// get target user data
200+
// if throws will be handled by caller or wrapper
200201
let [mailboxData, userData] = await Promise.all([this.getMailboxAsync(options), this.users.collection('users').findOne({ _id: options.user })]);
201202

202203
if (!userData) {
@@ -2201,8 +2202,8 @@ class MessageHandler {
22012202
this.notifier.addEntries(mailboxData, removeEntries, () => {
22022203
// mark messages as added to new mailbox
22032204
this.notifier.addEntries(targetData, existsEntries, () => {
2204-
removeEntries = [];
2205-
existsEntries = [];
2205+
removeEntries.length = 0; // Clear top-level argument array, setting length to 0 clears array object
2206+
existsEntries.length = 0;
22062207
this.notifier.fire(mailboxData.user);
22072208
return resolve(true);
22082209
});

0 commit comments

Comments
 (0)