mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 23:11:34 +01:00
Send hidden events to users that want them
This commit is contained in:
parent
5ec53ac808
commit
aaf0bb2f50
3 changed files with 10 additions and 2 deletions
|
@ -929,7 +929,6 @@ class SyncHandler:
|
||||||
for e in sync_config.filter_collection.filter_room_state(
|
for e in sync_config.filter_collection.filter_room_state(
|
||||||
list(state.values())
|
list(state.values())
|
||||||
)
|
)
|
||||||
if e.type != EventTypes.Aliases # until MSC2261 or alternative solution
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async def unread_notifs_for_room_id(
|
async def unread_notifs_for_room_id(
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Storage:
|
||||||
# rewrite all the existing code to split it into high vs low level
|
# rewrite all the existing code to split it into high vs low level
|
||||||
# interfaces.
|
# interfaces.
|
||||||
self.main = stores.main
|
self.main = stores.main
|
||||||
|
self.hs = hs
|
||||||
|
|
||||||
self.purge_events = PurgeEventsStorage(hs, stores)
|
self.purge_events = PurgeEventsStorage(hs, stores)
|
||||||
self.state = StateGroupStorage(hs, stores)
|
self.state = StateGroupStorage(hs, stores)
|
||||||
|
|
|
@ -97,6 +97,10 @@ async def filter_events_for_client(
|
||||||
room_id
|
room_id
|
||||||
] = await storage.main.get_retention_policy_for_room(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):
|
def allowed(event):
|
||||||
"""
|
"""
|
||||||
Args:
|
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
|
# 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
|
# see events in the room at that point in the DAG, and that shouldn't be decided
|
||||||
# on those checks.
|
# on those checks.
|
||||||
if filter_send_to_client:
|
if filter_send_to_client and not filter_override:
|
||||||
if event.type == "org.matrix.dummy_event":
|
if event.type == "org.matrix.dummy_event":
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -141,6 +145,10 @@ async def filter_events_for_client(
|
||||||
|
|
||||||
if event.origin_server_ts < oldest_allowed_ts:
|
if event.origin_server_ts < oldest_allowed_ts:
|
||||||
return None
|
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:
|
if event.event_id in always_include_ids:
|
||||||
return event
|
return event
|
||||||
|
|
Loading…
Reference in a new issue