mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-06 20:41:59 +00:00
Refactor a bit
This commit is contained in:
parent
37a9873f63
commit
8120a238a4
@ -118,26 +118,28 @@ def filter_events_for_client(
|
|||||||
|
|
||||||
the original event if they can see it as normal.
|
the original event if they can see it as normal.
|
||||||
"""
|
"""
|
||||||
if event.type == "org.matrix.dummy_event" and filter_send_to_client:
|
# Only run some checks if these events aren't about to be sent to clients. This is
|
||||||
|
# because, if this is not the case, we're probably only checking if the users can
|
||||||
|
# see events in the room at that point in the DAG, and that shouldn't be decided
|
||||||
|
# on those checks.
|
||||||
|
if filter_send_to_client:
|
||||||
|
if event.type == "org.matrix.dummy_event":
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if (
|
if not event.is_state() and event.sender in ignore_list:
|
||||||
not event.is_state()
|
|
||||||
and event.sender in ignore_list
|
|
||||||
and filter_send_to_client
|
|
||||||
):
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Until MSC2261 has landed we can't redact malicious alias events, so for
|
# Until MSC2261 has landed we can't redact malicious alias events, so for
|
||||||
# now we temporarily filter out m.room.aliases entirely to mitigate
|
# now we temporarily filter out m.room.aliases entirely to mitigate
|
||||||
# abuse, while we spec a better solution to advertising aliases
|
# abuse, while we spec a better solution to advertising aliases
|
||||||
# on rooms.
|
# on rooms.
|
||||||
if event.type == EventTypes.Aliases and filter_send_to_client:
|
if event.type == EventTypes.Aliases:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Don't try to apply the room's retention policy if the event is a state event, as
|
# Don't try to apply the room's retention policy if the event is a state
|
||||||
# MSC1763 states that retention is only considered for non-state events.
|
# event, as MSC1763 states that retention is only considered for non-state
|
||||||
if filter_send_to_client and not event.is_state():
|
# events.
|
||||||
|
if not event.is_state():
|
||||||
retention_policy = retention_policies[event.room_id]
|
retention_policy = retention_policies[event.room_id]
|
||||||
max_lifetime = retention_policy.get("max_lifetime")
|
max_lifetime = retention_policy.get("max_lifetime")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user