Mailspring/packages/nylas-sync/syncback_tasks/mark-thread-as-read.imap.js
2016-06-29 17:01:30 -07:00

19 lines
511 B
JavaScript

const SyncbackTask = require('./syncback-task')
const TaskHelpers = require('./task-helpers')
class MarkThreadAsRead extends SyncbackTask {
description() {
return `MarkThreadAsRead`;
}
run(db, imap) {
const threadId = this.syncbackRequestObject().props.threadId
const eachMsg = ({message, box}) => {
return box.addFlags(message.categoryUID, 'SEEN')
}
return TaskHelpers.forEachMessageInThread({threadId, db, imap, callback: eachMsg})
}
}
module.exports = MarkThreadAsRead;