fix(unread): Mark as read twice without visiting another unread thread

This commit is contained in:
Ben Gotow 2016-01-12 17:14:17 -08:00
parent e87766ebd5
commit b44ab5670b

View file

@ -163,20 +163,21 @@ class MessageStore extends NylasStore
# Override canBeUndone to return false so that we don't see undo
# prompts (since this is a passive action vs. a user-triggered
# action.)
return unless @_thread and @_thread.unread
return if not @_thread
return if @_lastLoadedThreadId is @_thread.id
@_lastLoadedThreadId = @_thread.id
markAsReadDelay = NylasEnv.config.get('core.reading.markAsReadDelay')
markAsReadId = @_thread.id
return if markAsReadDelay < 0
if @_thread.unread
markAsReadDelay = NylasEnv.config.get('core.reading.markAsReadDelay')
markAsReadId = @_thread.id
return if markAsReadDelay < 0
setTimeout =>
return unless markAsReadId is @_thread?.id and @_thread.unread
t = new ChangeUnreadTask(thread: @_thread, unread: false)
t.canBeUndone = => false
Actions.queueTask(t)
, markAsReadDelay
setTimeout =>
return unless markAsReadId is @_thread?.id and @_thread.unread
t = new ChangeUnreadTask(thread: @_thread, unread: false)
t.canBeUndone = => false
Actions.queueTask(t)
, markAsReadDelay
_onToggleAllMessagesExpanded: =>
if @hasCollapsedItems()