From 596db6e450218530bf5da4ec65deea74db4762b6 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 17 Jul 2015 18:51:15 -0700 Subject: [PATCH] fix(archive): With labels, "archive" means "remove from current label and add archive", not "remove from inbox" --- src/flux/tasks/archive-thread-helper.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/flux/tasks/archive-thread-helper.coffee b/src/flux/tasks/archive-thread-helper.coffee index 4b3caf141..0736d6984 100644 --- a/src/flux/tasks/archive-thread-helper.coffee +++ b/src/flux/tasks/archive-thread-helper.coffee @@ -1,4 +1,5 @@ CategoryStore = require '../stores/category-store' +FocusedCategoryStore = require '../stores/focused-category-store' ChangeLabelsTask = require './change-labels-task' ChangeFolderTask = require './change-folder-task' @@ -46,15 +47,16 @@ class ArchiveThreadHelper threadIds: threads.map (t) -> t.id else if namespace.usesLabels() - inboxLabel = CategoryStore.getStandardCategory("inbox") + currentLabel = FocusedCategoryStore.category() + currentLabel ?= CategoryStore.getStandardCategory("inbox") params = threadIds: threads.map (t) -> t.id if direction is "archive" - params.labelsToRemove = [inboxLabel] + params.labelsToRemove = [currentLabel] else if direction is "unarchive" - params.labelsToAdd = [inboxLabel] + params.labelsToAdd = [currentLabel] archiveLabel = CategoryStore.getStandardCategory("archive") if archiveLabel