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()