fix(notifs): Categories inside Threads need accountId. Fixes #1155

This commit is contained in:
Ben Gotow 2016-01-29 10:49:40 -08:00
parent 21ebd82ece
commit 180da72b77
2 changed files with 12 additions and 5 deletions

View file

@ -5,6 +5,7 @@ _ = require 'underscore'
AccountStore,
CategoryStore,
SoundRegistry,
FocusedPerspectiveStore,
NativeNotifications,
DatabaseStore} = require 'nylas-exports'
@ -56,9 +57,14 @@ module.exports =
else
NylasEnv.displayWindow()
filter = MailboxPerspective.forCategory(thread.categoryNamed('inbox'))
currentCategories = FocusedPerspectiveStore.current().categories()
desiredCategory = thread.categoryNamed('inbox')
return unless desiredCategory
unless desiredCategory.id in _.pluck(currentCategories, 'id')
filter = MailboxPerspective.forCategory(desiredCategory)
Actions.focusMailboxPerspective(filter)
Actions.setFocus(collection: 'thread', item: thread)
Actions.setFocus(collection: 'thread', item: thread)
_notifyMessages: ->
if @stack.length >= 5

View file

@ -109,9 +109,10 @@ class Thread extends Model
if value
@categories = @constructor.attributes.categories.fromJSON(value)
if @participants
for contact in @participants
contact.accountId = @accountId
for attr in ['participants', 'categories']
value = @[attr]
continue unless value and value instanceof Array
item.accountId = @accountId for item in value
@