mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
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:
parent
630448634c
commit
300d5dbc7f
|
@ -115,10 +115,13 @@ class SidebarItem
|
||||||
id += "-#{opts.name}" if opts.name
|
id += "-#{opts.name}" if opts.name
|
||||||
opts.name = "Snoozed" unless opts.name
|
opts.name = "Snoozed" unless opts.name
|
||||||
opts.iconName= 'snooze.png'
|
opts.iconName= 'snooze.png'
|
||||||
|
|
||||||
categories = accountIds.map (accId) =>
|
categories = accountIds.map (accId) =>
|
||||||
_.findWhere CategoryStore.userCategories(accId), {displayName}
|
_.findWhere CategoryStore.userCategories(accId), {displayName}
|
||||||
|
categories = _.compact(categories)
|
||||||
|
|
||||||
perspective = MailboxPerspective.forCategories(categories)
|
perspective = MailboxPerspective.forCategories(categories)
|
||||||
|
perspective.name = id unless perspective.name
|
||||||
@forPerspective(id, perspective, opts)
|
@forPerspective(id, perspective, opts)
|
||||||
|
|
||||||
@forStarred: (accountIds, opts = {}) ->
|
@forStarred: (accountIds, opts = {}) ->
|
||||||
|
|
|
@ -18,6 +18,7 @@ StandardCategories = {
|
||||||
|
|
||||||
LockedCategories = {
|
LockedCategories = {
|
||||||
"sent"
|
"sent"
|
||||||
|
"N1-Snoozed"
|
||||||
}
|
}
|
||||||
|
|
||||||
HiddenCategories = {
|
HiddenCategories = {
|
||||||
|
@ -27,6 +28,7 @@ HiddenCategories = {
|
||||||
"archive"
|
"archive"
|
||||||
"starred"
|
"starred"
|
||||||
"important"
|
"important"
|
||||||
|
"N1-Snoozed"
|
||||||
}
|
}
|
||||||
|
|
||||||
AllMailName = "all"
|
AllMailName = "all"
|
||||||
|
@ -110,10 +112,10 @@ class Category extends Model
|
||||||
StandardCategories[@name]? and @name isnt 'important'
|
StandardCategories[@name]? and @name isnt 'important'
|
||||||
|
|
||||||
isLockedCategory: ->
|
isLockedCategory: ->
|
||||||
LockedCategories[@name]?
|
LockedCategories[@name]? or LockedCategories[@displayName]?
|
||||||
|
|
||||||
isHiddenCategory: ->
|
isHiddenCategory: ->
|
||||||
HiddenCategories[@name]?
|
HiddenCategories[@name]? or HiddenCategories[@displayName]?
|
||||||
|
|
||||||
isUserCategory: ->
|
isUserCategory: ->
|
||||||
not @isStandardCategory() and not @isHiddenCategory()
|
not @isStandardCategory() and not @isHiddenCategory()
|
||||||
|
|
Loading…
Reference in a new issue