From 5ad35cf4d0008219c6ab4b78a46096c1adeae089 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 12 Jan 2016 17:14:17 -0800 Subject: [PATCH] fix(unread): Mark as read twice without visiting another unread thread --- src/flux/stores/message-store.coffee | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/flux/stores/message-store.coffee b/src/flux/stores/message-store.coffee index 07538097e..a6f6411b8 100644 --- a/src/flux/stores/message-store.coffee +++ b/src/flux/stores/message-store.coffee @@ -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()