mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 21:57:55 +08:00
31 lines
707 B
Text
31 lines
707 B
Text
|
import {
|
||
|
Actions,
|
||
|
Thread,
|
||
|
DatabaseStore,
|
||
|
TaskFactory,
|
||
|
SendDraftTask,
|
||
|
} from 'nylas-exports'
|
||
|
|
||
|
|
||
|
export const name = 'SendAndArchiveExtension'
|
||
|
|
||
|
export function sendActions() {
|
||
|
return [{
|
||
|
title: 'Send and Archive',
|
||
|
iconUrl: 'nylas://send-and-archive/images/composer-archive@2x.png',
|
||
|
isAvailableForDraft({draft}) {
|
||
|
return draft.threadId != null
|
||
|
},
|
||
|
performSendAction({draft}) {
|
||
|
Actions.queueTask(new SendDraftTask(draft.clientId))
|
||
|
return DatabaseStore.modelify(Thread, [draft.threadId])
|
||
|
.then((threads) => {
|
||
|
const tasks = TaskFactory.tasksForArchiving({
|
||
|
threads: threads,
|
||
|
})
|
||
|
Actions.queueTasks(tasks)
|
||
|
})
|
||
|
},
|
||
|
}]
|
||
|
}
|