mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-20 22:23:53 +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
4459fad47b
commit
4de7948500
2 changed files with 7 additions and 2 deletions
|
@ -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 = {}) ->
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue