diff options
Diffstat (limited to 'synapse/handlers/relations.py')
-rw-r--r-- | synapse/handlers/relations.py | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/synapse/handlers/relations.py b/synapse/handlers/relations.py index 4824635162..c8744e3ec7 100644 --- a/synapse/handlers/relations.py +++ b/synapse/handlers/relations.py @@ -124,7 +124,10 @@ class RelationsHandler: # Note that ignored users are not passed into get_relations_for_event # below. Ignored users are handled in filter_events_for_client (and by # not passing them in here we should get a better cache hit rate). - related_events, next_token = await self._main_store.get_relations_for_event( + ( + related_events, + next_token, + ) = await self._main_store.relations.get_relations_for_event( event_id=event_id, event=event, room_id=room_id, @@ -211,7 +214,7 @@ class RelationsHandler: ShadowBanError if the requester is shadow-banned """ related_event_ids = ( - await self._main_store.get_all_relations_for_event_with_types( + await self._main_store.relations.get_all_relations_for_event_with_types( event_id, relation_types ) ) @@ -250,7 +253,9 @@ class RelationsHandler: A map of event IDs to a list related events. """ - related_events = await self._main_store.get_references_for_events(event_ids) + related_events = await self._main_store.relations.get_references_for_events( + event_ids + ) # Avoid additional logic if there are no ignored users. if not ignored_users: @@ -304,7 +309,7 @@ class RelationsHandler: event_ids = [eid for eid in events_by_id.keys() if eid not in relations_by_id] # Fetch thread summaries. - summaries = await self._main_store.get_thread_summaries(event_ids) + summaries = await self._main_store.relations.get_thread_summaries(event_ids) # Limit fetching whether the requester has participated in a thread to # events which are thread roots. @@ -320,7 +325,7 @@ class RelationsHandler: # For events the requester did not send, check the database for whether # the requester sent a threaded reply. participated.update( - await self._main_store.get_threads_participated( + await self._main_store.relations.get_threads_participated( [ event_id for event_id in thread_event_ids @@ -331,8 +336,10 @@ class RelationsHandler: ) # Then subtract off the results for any ignored users. - ignored_results = await self._main_store.get_threaded_messages_per_user( - thread_event_ids, ignored_users + ignored_results = ( + await self._main_store.relations.get_threaded_messages_per_user( + thread_event_ids, ignored_users + ) ) # A map of event ID to the thread aggregation. @@ -361,7 +368,10 @@ class RelationsHandler: continue # Attempt to find another event to use as the latest event. - potential_events, _ = await self._main_store.get_relations_for_event( + ( + potential_events, + _, + ) = await self._main_store.relations.get_relations_for_event( event_id, event, room_id, @@ -498,7 +508,7 @@ class RelationsHandler: Note that there is no use in limiting edits by ignored users since the parent event should be ignored in the first place if the user is ignored. """ - edits = await self._main_store.get_applicable_edits( + edits = await self._main_store.relations.get_applicable_edits( [ event_id for event_id, event in events_by_id.items() @@ -553,7 +563,7 @@ class RelationsHandler: # Note that ignored users are not passed into get_threads # below. Ignored users are handled in filter_events_for_client (and by # not passing them in here we should get a better cache hit rate). - thread_roots, next_batch = await self._main_store.get_threads( + thread_roots, next_batch = await self._main_store.relations.get_threads( room_id=room_id, limit=limit, from_token=from_token ) @@ -565,7 +575,7 @@ class RelationsHandler: # For events the requester did not send, check the database for whether # the requester sent a threaded reply. participated.update( - await self._main_store.get_threads_participated( + await self._main_store.relations.get_threads_participated( [eid for eid, p in participated.items() if not p], user_id, ) |