summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-29 16:10:01 +0000
committerDavid Baker <dave@matrix.org>2015-01-29 16:10:01 +0000
commit8b1dd9f57f8afb2d602d3b533ab89dbe1df6b465 (patch)
tree3ee2739df8cb04c129afc4b981cfc0193b4d9fc0 /synapse
parentSYN-252: Supply the stream and topological parts in the correct order to the ... (diff)
downloadsynapse-8b1dd9f57f8afb2d602d3b533ab89dbe1df6b465.tar.xz
Only send a badge-reset if the user actually has unread notifications.
Diffstat (limited to '')
-rw-r--r--synapse/push/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 10ac890482..fa967c5a5d 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -56,6 +56,7 @@ class Pusher(object):
 
         # The last value of last_active_time that we saw
         self.last_last_active_time = 0
+        self.has_unread = True
 
     @defer.inlineCallbacks
     def _actions_for_event(self, ev):
@@ -180,6 +181,7 @@ class Pusher(object):
                 processed = True
             else:
                 rejected = yield self.dispatch_push(single_event, tweaks)
+                self.has_unread = True
                 if isinstance(rejected, list) or isinstance(rejected, tuple):
                     processed = True
                     for pk in rejected:
@@ -290,9 +292,12 @@ class Pusher(object):
         if 'last_active' in state.state:
             last_active = state.state['last_active']
             if last_active > self.last_last_active_time:
-                logger.info("Resetting badge count for %s", self.user_name)
-                self.reset_badge_count()
                 self.last_last_active_time = last_active
+                if self.has_unread:
+                    logger.info("Resetting badge count for %s", self.user_name)
+                    self.reset_badge_count()
+                    self.has_unread = False
+
 
 
 def _value_for_dotted_key(dotted_key, event):