fix(sidebar): Prevent error in snooze item when category doesnt exist

- Add Snooze category to locked and hidden categories to prevent from
  directly moving stuff to it and showing up in the user categories
  section
This commit is contained in:
Juan Tejada 2016-02-24 11:43:51 -08:00
parent 630448634c
commit 300d5dbc7f
2 changed files with 7 additions and 2 deletions

View file

@ -115,10 +115,13 @@ class SidebarItem
id += "-#{opts.name}" if opts.name
opts.name = "Snoozed" unless opts.name
opts.iconName= 'snooze.png'
categories = accountIds.map (accId) =>
_.findWhere CategoryStore.userCategories(accId), {displayName}
categories = _.compact(categories)
perspective = MailboxPerspective.forCategories(categories)
perspective.name = id unless perspective.name
@forPerspective(id, perspective, opts)
@forStarred: (accountIds, opts = {}) ->

View file

@ -18,6 +18,7 @@ StandardCategories = {
LockedCategories = {
"sent"
"N1-Snoozed"
}
HiddenCategories = {
@ -27,6 +28,7 @@ HiddenCategories = {
"archive"
"starred"
"important"
"N1-Snoozed"
}
AllMailName = "all"
@ -110,10 +112,10 @@ class Category extends Model
StandardCategories[@name]? and @name isnt 'important'
isLockedCategory: ->
LockedCategories[@name]?
LockedCategories[@name]? or LockedCategories[@displayName]?
isHiddenCategory: ->
HiddenCategories[@name]?
HiddenCategories[@name]? or HiddenCategories[@displayName]?
isUserCategory: ->
not @isStandardCategory() and not @isHiddenCategory()