Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix invite notifications for users without pushers #12840

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12840.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix an issue introduced in Synapse 0.34 where /notifications would only return notifications if a user registered at least one pusher. Contributed by Famedly.
deepbluev7 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 4 additions & 6 deletions synapse/push/bulk_push_rule_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ async def _get_rules_for_event(
if event.type == "m.room.member" and event.content["membership"] == "invite":
invited = event.state_key
if invited and self.hs.is_mine_id(invited):
has_pusher = await self.store.user_has_pusher(invited)
if has_pusher:
rules_by_user = dict(rules_by_user)
rules_by_user[invited] = await self.store.get_push_rules_for_user(
invited
)
rules_by_user = dict(rules_by_user)
rules_by_user[invited] = await self.store.get_push_rules_for_user(
invited
)

return rules_by_user

Expand Down
6 changes: 0 additions & 6 deletions synapse/storage/databases/main/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ def _decode_pushers_rows(self, rows: Iterable[dict]) -> Iterator[PusherConfig]:

yield PusherConfig(**r)

async def user_has_pusher(self, user_id: str) -> bool:
ret = await self.db_pool.simple_select_one_onecol(
"pushers", {"user_name": user_id}, "id", allow_none=True
)
return ret is not None

async def get_pushers_by_app_id_and_pushkey(
self, app_id: str, pushkey: str
) -> Iterator[PusherConfig]:
Expand Down