Fix stupid bug

anoa/redirect_instances
David Robertson 2023-02-02 16:47:39 +00:00
parent ea3210f8e5
commit c9564e08ba
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
1 changed files with 4 additions and 2 deletions

View File

@ -135,6 +135,7 @@ class BulkPushRuleEvaluator:
# little, we can skip fetching a huge number of push rules in large rooms.
# This helps make joins and leaves faster.
if event.type == EventTypes.Member:
local_users = []
# We never notify a user about their own actions. This is enforced in
# `_action_for_event_by_user` in the loop over `rules_by_user`, but we
# do the same check here to avoid unnecessary DB queries.
@ -146,8 +147,6 @@ class BulkPushRuleEvaluator:
)
if target_already_in_room:
local_users = [event.state_key]
else:
return {}
else:
# We get the users who may need to be notified by first fetching the
# local users currently in the room, finding those that have push rules,
@ -174,6 +173,9 @@ class BulkPushRuleEvaluator:
local_users = list(local_users)
local_users.append(invited)
if not local_users:
return {}
rules_by_user = await self.store.bulk_get_push_rules(local_users)
logger.debug("Users in room: %s", local_users)