0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-09-28 20:48:58 +02:00

Send hidden events to users that want them

This commit is contained in:
Tulir Asokan 2020-11-18 01:20:48 +02:00
parent 5ec53ac808
commit aaf0bb2f50
3 changed files with 10 additions and 2 deletions

View file

@ -929,7 +929,6 @@ class SyncHandler:
for e in sync_config.filter_collection.filter_room_state(
list(state.values())
)
if e.type != EventTypes.Aliases # until MSC2261 or alternative solution
}
async def unread_notifs_for_room_id(

View file

@ -46,6 +46,7 @@ class Storage:
# rewrite all the existing code to split it into high vs low level
# interfaces.
self.main = stores.main
self.hs = hs
self.purge_events = PurgeEventsStorage(hs, stores)
self.state = StateGroupStorage(hs, stores)

View file

@ -97,6 +97,10 @@ async def filter_events_for_client(
room_id
] = await storage.main.get_retention_policy_for_room(room_id)
# meow: let admins see secret events like org.matrix.dummy_event, m.room.aliases
# and events expired by the retention policy.
filter_override = user_id in storage.hs.config.meow.filter_override
def allowed(event):
"""
Args:
@ -115,7 +119,7 @@ async def filter_events_for_client(
# 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 filter_send_to_client and not filter_override:
if event.type == "org.matrix.dummy_event":
return None
@ -141,6 +145,10 @@ async def filter_events_for_client(
if event.origin_server_ts < oldest_allowed_ts:
return None
# meow: even with filter_override, we want to filter ignored users
elif filter_send_to_client and not event.is_state() and event.sender in ignore_list:
return None
if event.event_id in always_include_ids:
return event