diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 32e53c2d2..405ca7988 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -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( diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index bbff3c8d5..7bf4f1e11 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -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) diff --git a/synapse/visibility.py b/synapse/visibility.py index 527365498..60b41a323 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py @@ -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