diff --git a/spec/models/category-spec.coffee b/spec/models/category-spec.coffee index 19db7ae53..2a64e51c8 100644 --- a/spec/models/category-spec.coffee +++ b/spec/models/category-spec.coffee @@ -58,5 +58,5 @@ describe 'Category', -> cat.name = 'sent' expect(cat.isUserCategory()).toBe false expect(cat.isStandardCategory()).toBe true - expect(cat.isHiddenCategory()).toBe true + expect(cat.isHiddenCategory()).toBe false expect(cat.isLockedCategory()).toBe true diff --git a/spec/models/thread-spec.coffee b/spec/models/thread-spec.coffee index e5b6f8d64..9be67a467 100644 --- a/spec/models/thread-spec.coffee +++ b/spec/models/thread-spec.coffee @@ -70,8 +70,8 @@ describe 'Thread', -> expect(actualOut.length).toBe 1 expect(actualOut[0].displayName).toBe 'not important' - it "doesn't display 'sent', 'all', 'archive', or 'drafts'", -> - inputs = ['sent', 'all', 'archive', 'drafts'] + it "doesn't display 'all', 'archive', or 'drafts'", -> + inputs = ['all', 'archive', 'drafts'] actualOut = sortedForCategoryNames inputs expect(actualOut.length).toBe 0 diff --git a/src/flux/models/category.coffee b/src/flux/models/category.coffee index 6883c7eec..28533973f 100644 --- a/src/flux/models/category.coffee +++ b/src/flux/models/category.coffee @@ -18,11 +18,11 @@ StandardCategories = { LockedCategories = { "sent" + "drafts" "N1-Snoozed" } HiddenCategories = { - "sent" "drafts" "all" "archive" diff --git a/src/mailbox-perspective.coffee b/src/mailbox-perspective.coffee index 4e4d17091..4e2095aaf 100644 --- a/src/mailbox-perspective.coffee +++ b/src/mailbox-perspective.coffee @@ -305,14 +305,17 @@ class CategoryMailboxPerspective extends MailboxPerspective receiveThreads: (threadsOrIds) => FocusedPerspectiveStore = require './flux/stores/focused-perspective-store' - currentCategories = FocusedPerspectiveStore.current().categories() + current= FocusedPerspectiveStore.current() # This assumes that the we don't have more than one category per accountId # attached to this perspective DatabaseStore.modelify(Thread, threadsOrIds).then (threads) => tasks = TaskFactory.tasksForApplyingCategories threads: threads - categoriesToRemove: (accountId) -> _.filter(currentCategories, _.matcher({accountId})) + categoriesToRemove: (accountId) -> + if current.categoriesSharedName() in Category.LockedCategoryNames + return [] + return _.filter(current.categories(), _.matcher({accountId})) categoriesToAdd: (accountId) => [_.findWhere(@_categories, {accountId})] Actions.queueTasks(tasks)