Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 61ca89a

Browse files
committed
Make matches_user_in_member_list method private; update refs
References to this method wanted to check if an AS should receive events from a room. They were only checking to see if the AS had a user in the room, whereas the AS should also see those events if it has registered the room's ID or one of its aliases in the AS' relevant namespace.
1 parent 13558a5 commit 61ca89a

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

synapse/appservice/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _is_exclusive(self, namespace_key: str, test_string: str) -> bool:
176176
return False
177177

178178
@cached(num_args=1, cache_context=True)
179-
async def matches_user_in_member_list(
179+
async def _matches_user_in_member_list(
180180
self,
181181
room_id: str,
182182
store: "DataStore",
@@ -259,7 +259,7 @@ async def is_interested_in_room(
259259

260260
# And finally, perform an expensive check on whether any of the
261261
# users in the room match the appservice's user namespace
262-
return await self.matches_user_in_member_list(
262+
return await self._matches_user_in_member_list(
263263
room_id, store, on_invalidate=cache_context.invalidate
264264
)
265265

@@ -316,7 +316,7 @@ async def is_interested_in_presence(
316316

317317
# Then find out if the appservice is interested in any of those rooms
318318
for room_id in room_ids:
319-
if await self.matches_user_in_member_list(
319+
if await self.is_interested_in_room(
320320
room_id, store, on_invalidate=cache_context.invalidate
321321
):
322322
return True

synapse/handlers/receipts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async def get_new_events_as(
269269
# Then filter down to rooms that the AS can read
270270
events = []
271271
for room_id, event in rooms_to_events.items():
272-
if not await service.matches_user_in_member_list(room_id, self.store):
272+
if not await service.is_interested_in_room(room_id, self.store):
273273
continue
274274

275275
events.append(event)

synapse/handlers/typing.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,7 @@ async def get_new_events_as(
486486
if handler._room_serials[room_id] <= from_key:
487487
continue
488488

489-
if not await service.matches_user_in_member_list(
490-
room_id, self._main_store
491-
):
489+
if not await service.is_interested_in_room(room_id, self._main_store):
492490
continue
493491

494492
events.append(self._make_event_for(room_id))

0 commit comments

Comments
 (0)