diff options
author | Shay <hillerys@element.io> | 2022-05-20 01:54:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 09:54:12 +0100 |
commit | 71e8afe34d2103c5ccc9f2d1c99587d14b2acc56 (patch) | |
tree | 38ca83b911323cd5312165467e2b8bf077987d2a /synapse/push | |
parent | Fix `RetryDestinationLimiter` re-starting finished log contexts (#12803) (diff) | |
download | synapse-71e8afe34d2103c5ccc9f2d1c99587d14b2acc56.tar.xz |
Update EventContext `get_current_event_ids` and `get_prev_event_ids` to accept state filters and update calls where possible (#12791)
Diffstat (limited to 'synapse/push')
-rw-r--r-- | synapse/push/bulk_push_rule_evaluator.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py index 4ac2c546bf..4cc8a2ecca 100644 --- a/synapse/push/bulk_push_rule_evaluator.py +++ b/synapse/push/bulk_push_rule_evaluator.py @@ -20,7 +20,7 @@ import attr from prometheus_client import Counter from synapse.api.constants import EventTypes, Membership, RelationTypes -from synapse.event_auth import get_user_power_level +from synapse.event_auth import auth_types_for_event, get_user_power_level from synapse.events import EventBase, relation_from_event from synapse.events.snapshot import EventContext from synapse.state import POWER_KEY @@ -31,6 +31,7 @@ from synapse.util.caches.descriptors import lru_cache from synapse.util.caches.lrucache import LruCache from synapse.util.metrics import measure_func +from ..storage.state import StateFilter from .push_rule_evaluator import PushRuleEvaluatorForEvent if TYPE_CHECKING: @@ -168,8 +169,12 @@ class BulkPushRuleEvaluator: async def _get_power_levels_and_sender_level( self, event: EventBase, context: EventContext ) -> Tuple[dict, int]: - prev_state_ids = await context.get_prev_state_ids() + event_types = auth_types_for_event(event.room_version, event) + prev_state_ids = await context.get_prev_state_ids( + StateFilter.from_types(event_types) + ) pl_event_id = prev_state_ids.get(POWER_KEY) + if pl_event_id: # fastpath: if there's a power level event, that's all we need, and # not having a power level event is an extreme edge case |