From 72dd93aa026bfa52560a88d18c00c21b9c411793 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 11 Apr 2016 15:27:39 -0700 Subject: [PATCH] Clear window attention if all messages are marked read Fixes #758 // FREEBIE --- js/conversation_controller.js | 3 +++ js/panel_controller.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 47b35addc..1d410be54 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -62,6 +62,9 @@ storage.put("unreadCount", newUnreadCount); setUnreadCount(newUnreadCount); + if (newUnreadCount === 0) { + window.clearAttention(); + } } }))(); diff --git a/js/panel_controller.js b/js/panel_controller.js index 17bbf8b82..d46c69fda 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -22,6 +22,9 @@ extension.windows.drawAttention(inboxWindowId); } }; + window.clearAttention = function() { + extension.windows.clearAttention(inboxWindowId); + }; /* Inbox window controller */ var inboxFocused = false; @@ -58,7 +61,7 @@ }); appWindow.contentWindow.addEventListener('focus', function() { inboxFocused = true; - extension.windows.clearAttention(inboxWindowId); + clearAttention(); }); // close the inbox if background.html is refreshed