fix(important): Remove todo, reference to usesImportantFlag. Fixes #1331

This commit is contained in:
Ben Gotow 2016-02-16 11:41:15 -08:00
parent a9f7274bcf
commit 8f6dff7da8
2 changed files with 20 additions and 16 deletions

View file

@ -153,20 +153,25 @@ class ThreadList extends React.Component
_onSetImportant: (important) =>
threads = @_threadsForKeyboardAction()
return unless threads
# TODO Can not apply to threads across more than one account for now
account = AccountStore.accountForItems(threads)
return unless account?
return unless account.usesImportantFlag()
return unless NylasEnv.config.get('core.workspace.showImportant')
category = CategoryStore.getStandardCategory(account, 'important')
if important
task = TaskFactory.taskForApplyingCategory({threads, category})
else
task = TaskFactory.taskForRemovingCategory({threads, category})
Actions.queueTask(task)
if important
tasks = TaskFactory.tasksForApplyingCategories
threads: threads
categoriesToRemove: (accountId) -> []
categoryToAdd: (accountId) ->
CategoryStore.getStandardCategory(accountId, 'important')
else
tasks = TaskFactory.tasksForApplyingCategories
threads: threads
categoriesToRemove: (accountId) ->
important = CategoryStore.getStandardCategory(accountId, 'important')
return [important] if important
return []
categoryToAdd: (accountId) -> null
Actions.queueTasks(tasks)
_onSetUnread: (unread) =>
threads = @_threadsForKeyboardAction()
@ -180,9 +185,7 @@ class ThreadList extends React.Component
_onMarkAsSpam: =>
threads = @_threadsForKeyboardAction()
return unless threads
tasks = TaskFactory.tasksForMarkingAsSpam(
threads: threads
)
tasks = TaskFactory.tasksForMarkingAsSpam({threads})
Actions.queueTasks(tasks)
_onRemoveFromView: =>

View file

@ -89,7 +89,8 @@ class TaskFactory
threads: threads,
categoriesToRemove: (accountId) ->
[CategoryStore.getStandardCategory(accountId, 'inbox')]
categoryToAdd: (accountId) -> CategoryStore.getStandardCategory(accountId, 'spam')
categoryToAdd: (accountId) ->
CategoryStore.getStandardCategory(accountId, 'spam')
tasksForArchiving: ({threads, fromPerspective}) =>
@tasksForApplyingCategories