mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 22:54:13 -04:00
Handle the case of remote users leaving a partial join room for device lists (#13885)
This commit is contained in:
parent
85e161631a
commit
e8318a4333
7 changed files with 86 additions and 108 deletions
|
@ -662,31 +662,37 @@ class RoomMemberWorkerStore(EventsWorkerStore):
|
|||
if not user_ids:
|
||||
return set()
|
||||
|
||||
def _get_users_server_still_shares_room_with_txn(
|
||||
txn: LoggingTransaction,
|
||||
) -> Set[str]:
|
||||
sql = """
|
||||
SELECT state_key FROM current_state_events
|
||||
WHERE
|
||||
type = 'm.room.member'
|
||||
AND membership = 'join'
|
||||
AND %s
|
||||
GROUP BY state_key
|
||||
"""
|
||||
|
||||
clause, args = make_in_list_sql_clause(
|
||||
self.database_engine, "state_key", user_ids
|
||||
)
|
||||
|
||||
txn.execute(sql % (clause,), args)
|
||||
|
||||
return {row[0] for row in txn}
|
||||
|
||||
return await self.db_pool.runInteraction(
|
||||
"get_users_server_still_shares_room_with",
|
||||
_get_users_server_still_shares_room_with_txn,
|
||||
self.get_users_server_still_shares_room_with_txn,
|
||||
user_ids,
|
||||
)
|
||||
|
||||
def get_users_server_still_shares_room_with_txn(
|
||||
self,
|
||||
txn: LoggingTransaction,
|
||||
user_ids: Collection[str],
|
||||
) -> Set[str]:
|
||||
if not user_ids:
|
||||
return set()
|
||||
|
||||
sql = """
|
||||
SELECT state_key FROM current_state_events
|
||||
WHERE
|
||||
type = 'm.room.member'
|
||||
AND membership = 'join'
|
||||
AND %s
|
||||
GROUP BY state_key
|
||||
"""
|
||||
|
||||
clause, args = make_in_list_sql_clause(
|
||||
self.database_engine, "state_key", user_ids
|
||||
)
|
||||
|
||||
txn.execute(sql % (clause,), args)
|
||||
|
||||
return {row[0] for row in txn}
|
||||
|
||||
@cancellable
|
||||
async def get_rooms_for_user(
|
||||
self, user_id: str, on_invalidate: Optional[Callable[[], None]] = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue