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

Commit

Permalink
Only add rows to the push actions table if the event notifies or shou…
Browse files Browse the repository at this point in the history
…ld be marked unread (#8274)
  • Loading branch information
babolivier authored Sep 7, 2020
1 parent ef2804d commit d8762cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/8274.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).
7 changes: 6 additions & 1 deletion synapse/push/bulk_push_rule_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ async def action_for_event_by_user(self, event, context) -> None:
if event.type == EventTypes.Member and event.state_key == uid:
display_name = event.content.get("displayname", None)

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

for rule in rules:
if "enabled" in rule and not rule["enabled"]:
Expand Down

0 comments on commit d8762cc

Please sign in to comment.