mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
fix(important): Fix bugs in "important" label categorization
This commit is contained in:
parent
09a2096690
commit
e27c9eaca5
3 changed files with 22 additions and 12 deletions
|
@ -65,10 +65,9 @@ c3 = new ListTabular.Column
|
||||||
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
||||||
|
|
||||||
currentCategories = FocusedPerspectiveStore.current().categories() ? []
|
currentCategories = FocusedPerspectiveStore.current().categories() ? []
|
||||||
account = FocusedPerspectiveStore.current().account
|
|
||||||
|
|
||||||
ignoredIds = _.pluck(currentCategories, 'id')
|
ignored = [].concat(currentCategories, CategoryStore.hiddenCategories(thread.accountId))
|
||||||
ignoredIds.push(cat.id) for cat in CategoryStore.hiddenCategories(account)
|
ignoredIds = _.pluck(ignored, 'id')
|
||||||
|
|
||||||
for label in (thread.sortedCategories())
|
for label in (thread.sortedCategories())
|
||||||
continue if label.id in ignoredIds
|
continue if label.id in ignoredIds
|
||||||
|
|
|
@ -6,8 +6,13 @@ Account = require '../models/account'
|
||||||
{Categories} = require 'nylas-observables'
|
{Categories} = require 'nylas-observables'
|
||||||
Rx = require 'rx-lite'
|
Rx = require 'rx-lite'
|
||||||
|
|
||||||
asAccount = (a) -> if a instanceof Account then a else AccountStore.accountForId(a)
|
asAccount = (a) ->
|
||||||
asAccountId = (a) -> if a instanceof Account then a.id else a
|
throw new Error("You must pass an Account or Account Id") unless a
|
||||||
|
if a instanceof Account then a else AccountStore.accountForId(a)
|
||||||
|
|
||||||
|
asAccountId = (a) ->
|
||||||
|
throw new Error("You must pass an Account or Account Id") unless a
|
||||||
|
if a instanceof Account then a.id else a
|
||||||
|
|
||||||
class CategoryStore extends NylasStore
|
class CategoryStore extends NylasStore
|
||||||
|
|
||||||
|
@ -17,7 +22,11 @@ class CategoryStore extends NylasStore
|
||||||
@_userCategories = {}
|
@_userCategories = {}
|
||||||
@_hiddenCategories = {}
|
@_hiddenCategories = {}
|
||||||
|
|
||||||
@_disposable = Categories
|
NylasEnv.config.observe 'core.workspace.showImportant', =>
|
||||||
|
return unless @_categoryResult
|
||||||
|
@_onCategoriesChanged(@_categoryResult)
|
||||||
|
|
||||||
|
Categories
|
||||||
.forAllAccounts()
|
.forAllAccounts()
|
||||||
.sort()
|
.sort()
|
||||||
.subscribe(@_onCategoriesChanged)
|
.subscribe(@_onCategoriesChanged)
|
||||||
|
@ -95,6 +104,7 @@ class CategoryStore extends NylasStore
|
||||||
@getStandardCategory(accountOrId, "trash")
|
@getStandardCategory(accountOrId, "trash")
|
||||||
|
|
||||||
_onCategoriesChanged: (categories) =>
|
_onCategoriesChanged: (categories) =>
|
||||||
|
@_categoryResult = categories
|
||||||
@_categoryCache = {}
|
@_categoryCache = {}
|
||||||
for cat in categories
|
for cat in categories
|
||||||
@_categoryCache[cat.accountId] ?= {}
|
@_categoryCache[cat.accountId] ?= {}
|
||||||
|
|
|
@ -55,12 +55,13 @@ class WorkspaceStore extends NylasStore
|
||||||
'navigation:go-to-label' : => ## TODO
|
'navigation:go-to-label' : => ## TODO
|
||||||
|
|
||||||
_setMailViewByName: (categoryName) ->
|
_setMailViewByName: (categoryName) ->
|
||||||
account = FocusedPerspectiveStore.current().account
|
accountIds = FocusedPerspectiveStore.current().accountIds
|
||||||
category = CategoryStore.getStandardCategory(account, categoryName)
|
categories = accountIds.map (aid) -> CategoryStore.getStandardCategory(aid, categoryName)
|
||||||
return unless category
|
categories = _.compact(categories)
|
||||||
view = MailboxPerspective.forCategory(category)
|
|
||||||
return unless view
|
if categories.length > 0
|
||||||
Actions.focusMailboxPerspective(view)
|
view = MailboxPerspective.forCategories(categories)
|
||||||
|
Actions.focusMailboxPerspective(view)
|
||||||
|
|
||||||
_selectDraftsSheet: ->
|
_selectDraftsSheet: ->
|
||||||
Actions.selectRootSheet(@Sheet.Drafts)
|
Actions.selectRootSheet(@Sheet.Drafts)
|
||||||
|
|
Loading…
Reference in a new issue