mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-06 04:35:30 +08:00
When running syncback requests, if a task is meant to change the UID of a message (e.g. move it to a new folder), that task should be run after other tasks that don't affect the UID. Otherwise, when trying to run the other tasks, they would reference a UID that is no longer valid. This commit will make sure that we run any tasks that will change message uids last, /and/ make sure that we don't run more than 1 task that will affect the uids of the same messages in a row (i.e. without running a sync loop in between)
19 lines
520 B
JavaScript
19 lines
520 B
JavaScript
const SyncbackTask = require('./syncback-task')
|
|
const TaskHelpers = require('./task-helpers')
|
|
|
|
class DeleteMessageIMAP extends SyncbackTask {
|
|
description() {
|
|
return `DeleteMessage`;
|
|
}
|
|
|
|
affectsImapMessageUIDs() {
|
|
return false
|
|
}
|
|
|
|
async run(db, imap) {
|
|
const messageId = this.syncbackRequestObject().props.messageId
|
|
const {box, message} = await TaskHelpers.openMessageBox({messageId, db, imap})
|
|
return box.addFlags(message.folderImapUID, ['DELETED'])
|
|
}
|
|
}
|
|
module.exports = DeleteMessageIMAP;
|