mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
fix(send+archive): Update to use focused perspective
This commit is contained in:
parent
fde868a62e
commit
685fa625a5
2 changed files with 12 additions and 5 deletions
|
@ -1,8 +1,10 @@
|
|||
{React,
|
||||
Actions,
|
||||
Thread,
|
||||
DatabaseStore,
|
||||
TaskFactory,
|
||||
ComposerExtension,
|
||||
FocusedMailViewStore} = require 'nylas-exports'
|
||||
FocusedPerspectiveStore} = require 'nylas-exports'
|
||||
|
||||
{RetinaImg} = require 'nylas-component-kit'
|
||||
|
||||
|
@ -18,9 +20,10 @@ class SendAndArchiveExtension extends ComposerExtension
|
|||
|
||||
@_sendAndArchive: ({draft}) ->
|
||||
Actions.sendDraft(draft.clientId)
|
||||
archiveTask = TaskFactory.taskForArchiving
|
||||
threads: [draft.threadId]
|
||||
fromView: FocusedMailViewStore.mailView()
|
||||
Actions.queueTask(archiveTask)
|
||||
DatabaseStore.modelify(Thread, [draft.threadId]).then (threads) =>
|
||||
tasks = TaskFactory.tasksForArchiving
|
||||
threads: threads
|
||||
fromPerspective: FocusedPerspectiveStore.current()
|
||||
Actions.queueTasks(tasks)
|
||||
|
||||
module.exports = SendAndArchiveExtension
|
||||
|
|
|
@ -5,6 +5,7 @@ ChangeUnreadTask = require './change-unread-task'
|
|||
ChangeStarredTask = require './change-starred-task'
|
||||
AccountStore = require '../stores/account-store'
|
||||
CategoryStore = require '../stores/category-store'
|
||||
Thread = require '../models/thread'
|
||||
|
||||
class TaskFactory
|
||||
|
||||
|
@ -13,6 +14,9 @@ class TaskFactory
|
|||
tasks = []
|
||||
|
||||
for thread in threads
|
||||
unless thread instanceof Thread
|
||||
throw new Error("tasksForApplyingCategories: `threads` must be instances of Thread")
|
||||
|
||||
accountId = thread.accountId
|
||||
byAccount[accountId] ?=
|
||||
categoriesToRemove: categoriesToRemove?(accountId) ? []
|
||||
|
|
Loading…
Reference in a new issue