mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-07 16:48:02 +08:00
25 lines
782 B
JavaScript
25 lines
782 B
JavaScript
import { Actions, Thread, DatabaseStore, TaskFactory, SendDraftTask } from 'mailspring-exports';
|
|
|
|
export const name = 'SendAndArchiveExtension';
|
|
|
|
export function sendActions() {
|
|
return [
|
|
{
|
|
title: 'Send and Archive',
|
|
iconUrl: 'mailspring://send-and-archive/images/composer-archive@2x.png',
|
|
isAvailableForDraft({ draft }) {
|
|
return draft.threadId != null;
|
|
},
|
|
performSendAction({ draft }) {
|
|
Actions.queueTask(new SendDraftTask({ draft }));
|
|
return DatabaseStore.modelify(Thread, [draft.threadId]).then(threads => {
|
|
const tasks = TaskFactory.tasksForArchiving({
|
|
source: 'Send and Archive',
|
|
threads: threads,
|
|
});
|
|
Actions.queueTasks(tasks);
|
|
});
|
|
},
|
|
},
|
|
];
|
|
}
|