Use the unread notification count to send accurate badge counts in push notifications.

This commit is contained in:
David Baker 2016-01-13 18:55:57 +00:00
parent 37716d55ed
commit 12623c99b6
3 changed files with 87 additions and 46 deletions

View file

@ -31,21 +31,6 @@ class PusherPool:
self.pushers = {}
self.last_pusher_started = -1
distributor = self.hs.get_distributor()
distributor.observe(
"user_presence_changed", self.user_presence_changed
)
@defer.inlineCallbacks
def user_presence_changed(self, user, state):
user_name = user.to_string()
# until we have read receipts, pushers use this to reset a user's
# badge counters to zero
for p in self.pushers.values():
if p.user_name == user_name:
yield p.presence_changed(state)
@defer.inlineCallbacks
def start(self):
pushers = yield self.store.get_all_pushers()