mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 07:44:16 -04:00
Update get_users_in_room
mis-use to get hosts with dedicated get_current_hosts_in_room
(#13605)
See https://github.com/matrix-org/synapse/pull/13575#discussion_r953023755
This commit is contained in:
parent
d58615c82c
commit
1a209efdb2
6 changed files with 31 additions and 17 deletions
|
@ -30,7 +30,7 @@ from synapse.api.errors import (
|
|||
from synapse.appservice import ApplicationService
|
||||
from synapse.module_api import NOT_SPAM
|
||||
from synapse.storage.databases.main.directory import RoomAliasMapping
|
||||
from synapse.types import JsonDict, Requester, RoomAlias, get_domain_from_id
|
||||
from synapse.types import JsonDict, Requester, RoomAlias
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
@ -83,8 +83,9 @@ class DirectoryHandler:
|
|||
# TODO(erikj): Add transactions.
|
||||
# TODO(erikj): Check if there is a current association.
|
||||
if not servers:
|
||||
users = await self.store.get_users_in_room(room_id)
|
||||
servers = {get_domain_from_id(u) for u in users}
|
||||
servers = await self._storage_controllers.state.get_current_hosts_in_room(
|
||||
room_id
|
||||
)
|
||||
|
||||
if not servers:
|
||||
raise SynapseError(400, "Failed to get server list")
|
||||
|
@ -287,8 +288,9 @@ class DirectoryHandler:
|
|||
Codes.NOT_FOUND,
|
||||
)
|
||||
|
||||
users = await self.store.get_users_in_room(room_id)
|
||||
extra_servers = {get_domain_from_id(u) for u in users}
|
||||
extra_servers = await self._storage_controllers.state.get_current_hosts_in_room(
|
||||
room_id
|
||||
)
|
||||
servers_set = set(extra_servers) | set(servers)
|
||||
|
||||
# If this server is in the list of servers, return it first.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue