mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Fix code-style
This commit is contained in:
parent
33391db5f8
commit
9150a0d62e
@ -98,10 +98,8 @@ class Filtering(object):
|
|||||||
# room checks
|
# room checks
|
||||||
if hasattr(event, "room_id"):
|
if hasattr(event, "room_id"):
|
||||||
room_id = event.room_id
|
room_id = event.room_id
|
||||||
allow_rooms = definition["rooms"] if "rooms" in definition else None
|
allow_rooms = definition.get("rooms", None)
|
||||||
reject_rooms = (
|
reject_rooms = definition.get("not_rooms", None)
|
||||||
definition["not_rooms"] if "not_rooms" in definition else None
|
|
||||||
)
|
|
||||||
if reject_rooms and room_id in reject_rooms:
|
if reject_rooms and room_id in reject_rooms:
|
||||||
return False
|
return False
|
||||||
if allow_rooms and room_id not in allow_rooms:
|
if allow_rooms and room_id not in allow_rooms:
|
||||||
@ -111,12 +109,8 @@ class Filtering(object):
|
|||||||
if hasattr(event, "sender"):
|
if hasattr(event, "sender"):
|
||||||
# Should we be including event.state_key for some event types?
|
# Should we be including event.state_key for some event types?
|
||||||
sender = event.sender
|
sender = event.sender
|
||||||
allow_senders = (
|
allow_senders = definition.get("senders", None)
|
||||||
definition["senders"] if "senders" in definition else None
|
reject_senders = definition.get("not_senders", None)
|
||||||
)
|
|
||||||
reject_senders = (
|
|
||||||
definition["not_senders"] if "not_senders" in definition else None
|
|
||||||
)
|
|
||||||
if reject_senders and sender in reject_senders:
|
if reject_senders and sender in reject_senders:
|
||||||
return False
|
return False
|
||||||
if allow_senders and sender not in allow_senders:
|
if allow_senders and sender not in allow_senders:
|
||||||
@ -176,7 +170,6 @@ class Filtering(object):
|
|||||||
if key in user_filter["room"]:
|
if key in user_filter["room"]:
|
||||||
self._check_definition(user_filter["room"][key])
|
self._check_definition(user_filter["room"][key])
|
||||||
|
|
||||||
|
|
||||||
def _check_definition(self, definition):
|
def _check_definition(self, definition):
|
||||||
"""Check if the provided definition is valid.
|
"""Check if the provided definition is valid.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user