mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 03:54:58 -04:00
Prevent duplicate push notifications for room reads (#11835)
This commit is contained in:
parent
73fc488783
commit
4077177390
3 changed files with 73 additions and 68 deletions
|
@ -109,6 +109,7 @@ class HttpPusher(Pusher):
|
|||
self.data_minus_url = {}
|
||||
self.data_minus_url.update(self.data)
|
||||
del self.data_minus_url["url"]
|
||||
self.badge_count_last_call: Optional[int] = None
|
||||
|
||||
def on_started(self, should_check_for_notifs: bool) -> None:
|
||||
"""Called when this pusher has been started.
|
||||
|
@ -136,7 +137,9 @@ class HttpPusher(Pusher):
|
|||
self.user_id,
|
||||
group_by_room=self._group_unread_count_by_room,
|
||||
)
|
||||
await self._send_badge(badge)
|
||||
if self.badge_count_last_call is None or self.badge_count_last_call != badge:
|
||||
self.badge_count_last_call = badge
|
||||
await self._send_badge(badge)
|
||||
|
||||
def on_timer(self) -> None:
|
||||
self._start_processing()
|
||||
|
@ -402,6 +405,8 @@ class HttpPusher(Pusher):
|
|||
rejected = []
|
||||
if "rejected" in resp:
|
||||
rejected = resp["rejected"]
|
||||
else:
|
||||
self.badge_count_last_call = badge
|
||||
return rejected
|
||||
|
||||
async def _send_badge(self, badge: int) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue