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

Commit d8762cc

Browse files
authored
Only add rows to the push actions table if the event notifies or should be marked unread (#8274)
1 parent ef2804d commit d8762cc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

changelog.d/8274.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).

synapse/push/bulk_push_rule_evaluator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ async def action_for_event_by_user(self, event, context) -> None:
219219
if event.type == EventTypes.Member and event.state_key == uid:
220220
display_name = event.content.get("displayname", None)
221221

222-
actions_by_user[uid] = []
222+
if count_as_unread:
223+
# Add an element for the current user if the event needs to be marked as
224+
# unread, so that add_push_actions_to_staging iterates over it.
225+
# If the event shouldn't be marked as unread but should notify the
226+
# current user, it'll be added to the dict later.
227+
actions_by_user[uid] = []
223228

224229
for rule in rules:
225230
if "enabled" in rule and not rule["enabled"]:

0 commit comments

Comments
 (0)