Merge pull request #442 from nodemailer/ZMS-57

Do not use sorting for mass action tasks
This commit is contained in:
Andris Reinman 2022-12-22 09:59:03 +02:00 committed by GitHub
commit ff46dab195
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,7 @@ let run = async (task, data, options) => {
} }
} }
let cursor = await db.database.collection('messages').find(filter).sort({ uid: -1 }); let cursor = await db.database.collection('messages').find(filter);
let messageData; let messageData;
@ -51,18 +51,6 @@ let run = async (task, data, options) => {
if (action.moveTo && action.moveTo.toString() !== messageData.mailbox.toString()) { if (action.moveTo && action.moveTo.toString() !== messageData.mailbox.toString()) {
try { try {
console.log({
user,
source: {
user: messageData.user,
mailbox: messageData.mailbox
},
destination: {
mailbox: mailboxData._id
},
updates: Object.keys(updates).length ? updates : false,
messageQuery: messageData.uid
});
await moveMessage({ await moveMessage({
user, user,
source: { source: {