2016-01-26 06:14:09 +08:00
|
|
|
{React,
|
|
|
|
Actions,
|
2016-01-30 11:01:47 +08:00
|
|
|
Thread,
|
|
|
|
DatabaseStore,
|
2016-01-26 06:14:09 +08:00
|
|
|
TaskFactory,
|
|
|
|
ComposerExtension,
|
2016-01-30 11:01:47 +08:00
|
|
|
FocusedPerspectiveStore} = require 'nylas-exports'
|
2016-01-26 06:14:09 +08:00
|
|
|
|
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
|
|
|
|
class SendAndArchiveExtension extends ComposerExtension
|
|
|
|
@sendActionConfig: ({draft}) ->
|
|
|
|
if draft.threadId
|
|
|
|
return {
|
|
|
|
title: "Send and Archive"
|
|
|
|
iconUrl: "nylas://send-and-archive/images/composer-archive@2x.png"
|
|
|
|
onSend: @_sendAndArchive
|
|
|
|
}
|
|
|
|
else return null
|
|
|
|
|
|
|
|
@_sendAndArchive: ({draft}) ->
|
|
|
|
Actions.sendDraft(draft.clientId)
|
2016-01-30 11:01:47 +08:00
|
|
|
DatabaseStore.modelify(Thread, [draft.threadId]).then (threads) =>
|
|
|
|
tasks = TaskFactory.tasksForArchiving
|
|
|
|
threads: threads
|
|
|
|
Actions.queueTasks(tasks)
|
2016-01-26 06:14:09 +08:00
|
|
|
|
|
|
|
module.exports = SendAndArchiveExtension
|