mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 18:05:06 -04:00
Do not consider events by ignored users for relations (#12285)
Filter the events returned from `/relations` for the requester's ignored users in a similar way to `/messages` (and `/sync`).
This commit is contained in:
parent
5436b014f4
commit
4df10d3214
7 changed files with 90 additions and 4 deletions
|
@ -21,6 +21,7 @@ from synapse.api.constants import RelationTypes
|
|||
from synapse.api.errors import SynapseError
|
||||
from synapse.events import EventBase
|
||||
from synapse.types import JsonDict, Requester, StreamToken
|
||||
from synapse.visibility import filter_events_for_client
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
@ -62,6 +63,7 @@ class BundledAggregations:
|
|||
class RelationsHandler:
|
||||
def __init__(self, hs: "HomeServer"):
|
||||
self._main_store = hs.get_datastores().main
|
||||
self._storage = hs.get_storage()
|
||||
self._auth = hs.get_auth()
|
||||
self._clock = hs.get_clock()
|
||||
self._event_handler = hs.get_event_handler()
|
||||
|
@ -103,7 +105,8 @@ class RelationsHandler:
|
|||
|
||||
user_id = requester.user.to_string()
|
||||
|
||||
await self._auth.check_user_in_room_or_world_readable(
|
||||
# TODO Properly handle a user leaving a room.
|
||||
(_, member_event_id) = await self._auth.check_user_in_room_or_world_readable(
|
||||
room_id, user_id, allow_departed_users=True
|
||||
)
|
||||
|
||||
|
@ -130,6 +133,10 @@ class RelationsHandler:
|
|||
[c["event_id"] for c in pagination_chunk.chunk]
|
||||
)
|
||||
|
||||
events = await filter_events_for_client(
|
||||
self._storage, user_id, events, is_peeking=(member_event_id is None)
|
||||
)
|
||||
|
||||
now = self._clock.time_msec()
|
||||
# Do not bundle aggregations when retrieving the original event because
|
||||
# we want the content before relations are applied to it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue