0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 23:43:55 +01:00

Only add rows to the push actions table if the event notifies or should be marked unread (#8274)

This commit is contained in:
Brendan Abolivier 2020-09-07 16:56:27 +01:00 committed by GitHub
parent ef2804d27c
commit d8762cc116
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

1
changelog.d/8274.feature Normal file
View file

@ -0,0 +1 @@
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).

View file

@ -219,6 +219,11 @@ class BulkPushRuleEvaluator:
if event.type == EventTypes.Member and event.state_key == uid:
display_name = event.content.get("displayname", None)
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: