mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-26 19:47:05 +03:00
Merge pull request #2926 from matrix-org/erikj/member_handler_move
Move RoomMemberHandler out of Handlers
This commit is contained in:
commit
483e8104db
11 changed files with 51 additions and 39 deletions
|
@ -17,7 +17,6 @@ from .register import RegistrationHandler
|
||||||
from .room import (
|
from .room import (
|
||||||
RoomCreationHandler, RoomContextHandler,
|
RoomCreationHandler, RoomContextHandler,
|
||||||
)
|
)
|
||||||
from .room_member import RoomMemberHandler
|
|
||||||
from .message import MessageHandler
|
from .message import MessageHandler
|
||||||
from .federation import FederationHandler
|
from .federation import FederationHandler
|
||||||
from .directory import DirectoryHandler
|
from .directory import DirectoryHandler
|
||||||
|
@ -49,7 +48,6 @@ class Handlers(object):
|
||||||
self.registration_handler = RegistrationHandler(hs)
|
self.registration_handler = RegistrationHandler(hs)
|
||||||
self.message_handler = MessageHandler(hs)
|
self.message_handler = MessageHandler(hs)
|
||||||
self.room_creation_handler = RoomCreationHandler(hs)
|
self.room_creation_handler = RoomCreationHandler(hs)
|
||||||
self.room_member_handler = RoomMemberHandler(hs)
|
|
||||||
self.federation_handler = FederationHandler(hs)
|
self.federation_handler = FederationHandler(hs)
|
||||||
self.directory_handler = DirectoryHandler(hs)
|
self.directory_handler = DirectoryHandler(hs)
|
||||||
self.admin_handler = AdminHandler(hs)
|
self.admin_handler = AdminHandler(hs)
|
||||||
|
|
|
@ -158,7 +158,7 @@ class BaseHandler(object):
|
||||||
# homeserver.
|
# homeserver.
|
||||||
requester = synapse.types.create_requester(
|
requester = synapse.types.create_requester(
|
||||||
target_user, is_guest=True)
|
target_user, is_guest=True)
|
||||||
handler = self.hs.get_handlers().room_member_handler
|
handler = self.hs.get_room_member_handler()
|
||||||
yield handler.update_membership(
|
yield handler.update_membership(
|
||||||
requester,
|
requester,
|
||||||
target_user,
|
target_user,
|
||||||
|
|
|
@ -2153,7 +2153,7 @@ class FederationHandler(BaseHandler):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
yield self._check_signature(event, context)
|
yield self._check_signature(event, context)
|
||||||
member_handler = self.hs.get_handlers().room_member_handler
|
member_handler = self.hs.get_room_member_handler()
|
||||||
yield member_handler.send_membership_event(None, event, context)
|
yield member_handler.send_membership_event(None, event, context)
|
||||||
else:
|
else:
|
||||||
destinations = set(x.split(":", 1)[-1] for x in (sender_user_id, room_id))
|
destinations = set(x.split(":", 1)[-1] for x in (sender_user_id, room_id))
|
||||||
|
@ -2197,7 +2197,7 @@ class FederationHandler(BaseHandler):
|
||||||
# TODO: Make sure the signatures actually are correct.
|
# TODO: Make sure the signatures actually are correct.
|
||||||
event.signatures.update(returned_invite.signatures)
|
event.signatures.update(returned_invite.signatures)
|
||||||
|
|
||||||
member_handler = self.hs.get_handlers().room_member_handler
|
member_handler = self.hs.get_room_member_handler()
|
||||||
yield member_handler.send_membership_event(None, event, context)
|
yield member_handler.send_membership_event(None, event, context)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
|
@ -233,7 +233,7 @@ class ProfileHandler(BaseHandler):
|
||||||
)
|
)
|
||||||
|
|
||||||
for room_id in room_ids:
|
for room_id in room_ids:
|
||||||
handler = self.hs.get_handlers().room_member_handler
|
handler = self.hs.get_room_member_handler()
|
||||||
try:
|
try:
|
||||||
# Assume the target_user isn't a guest,
|
# Assume the target_user isn't a guest,
|
||||||
# because we don't let guests set profile or avatar data.
|
# because we don't let guests set profile or avatar data.
|
||||||
|
|
|
@ -165,7 +165,7 @@ class RoomCreationHandler(BaseHandler):
|
||||||
|
|
||||||
creation_content = config.get("creation_content", {})
|
creation_content = config.get("creation_content", {})
|
||||||
|
|
||||||
room_member_handler = self.hs.get_handlers().room_member_handler
|
room_member_handler = self.hs.get_room_member_handler()
|
||||||
|
|
||||||
yield self._send_events_for_new_room(
|
yield self._send_events_for_new_room(
|
||||||
requester,
|
requester,
|
||||||
|
@ -224,7 +224,7 @@ class RoomCreationHandler(BaseHandler):
|
||||||
id_server = invite_3pid["id_server"]
|
id_server = invite_3pid["id_server"]
|
||||||
address = invite_3pid["address"]
|
address = invite_3pid["address"]
|
||||||
medium = invite_3pid["medium"]
|
medium = invite_3pid["medium"]
|
||||||
yield self.hs.get_handlers().room_member_handler.do_3pid_invite(
|
yield self.hs.get_room_member_handler().do_3pid_invite(
|
||||||
room_id,
|
room_id,
|
||||||
requester.user,
|
requester.user,
|
||||||
medium,
|
medium,
|
||||||
|
|
|
@ -30,24 +30,32 @@ from synapse.api.errors import AuthError, SynapseError, Codes
|
||||||
from synapse.types import UserID, RoomID
|
from synapse.types import UserID, RoomID
|
||||||
from synapse.util.async import Linearizer
|
from synapse.util.async import Linearizer
|
||||||
from synapse.util.distributor import user_left_room, user_joined_room
|
from synapse.util.distributor import user_left_room, user_joined_room
|
||||||
from ._base import BaseHandler
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
id_server_scheme = "https://"
|
id_server_scheme = "https://"
|
||||||
|
|
||||||
|
|
||||||
class RoomMemberHandler(BaseHandler):
|
class RoomMemberHandler(object):
|
||||||
# TODO(paul): This handler currently contains a messy conflation of
|
# TODO(paul): This handler currently contains a messy conflation of
|
||||||
# low-level API that works on UserID objects and so on, and REST-level
|
# low-level API that works on UserID objects and so on, and REST-level
|
||||||
# API that takes ID strings and returns pagination chunks. These concerns
|
# API that takes ID strings and returns pagination chunks. These concerns
|
||||||
# ought to be separated out a lot better.
|
# ought to be separated out a lot better.
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(RoomMemberHandler, self).__init__(hs)
|
self.hs = hs
|
||||||
|
self.store = hs.get_datastore()
|
||||||
|
self.auth = hs.get_auth()
|
||||||
|
self.state_handler = hs.get_state_handler()
|
||||||
|
self.config = hs.config
|
||||||
|
self.simple_http_client = hs.get_simple_http_client()
|
||||||
|
|
||||||
|
self.federation_handler = hs.get_handlers().federation_handler
|
||||||
|
self.directory_handler = hs.get_handlers().directory_handler
|
||||||
|
self.registration_handler = hs.get_handlers().registration_handler
|
||||||
self.profile_handler = hs.get_profile_handler()
|
self.profile_handler = hs.get_profile_handler()
|
||||||
self.event_creation_hander = hs.get_event_creation_handler()
|
self.event_creation_hander = hs.get_event_creation_handler()
|
||||||
|
self.replication_layer = hs.get_replication_layer()
|
||||||
|
|
||||||
self.member_linearizer = Linearizer(name="member")
|
self.member_linearizer = Linearizer(name="member")
|
||||||
|
|
||||||
|
@ -138,7 +146,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
# join dance for now, since we're kinda implicitly checking
|
# join dance for now, since we're kinda implicitly checking
|
||||||
# that we are allowed to join when we decide whether or not we
|
# that we are allowed to join when we decide whether or not we
|
||||||
# need to do the invite/join dance.
|
# need to do the invite/join dance.
|
||||||
yield self.hs.get_handlers().federation_handler.do_invite_join(
|
yield self.federation_handler.do_invite_join(
|
||||||
remote_room_hosts,
|
remote_room_hosts,
|
||||||
room_id,
|
room_id,
|
||||||
user.to_string(),
|
user.to_string(),
|
||||||
|
@ -204,8 +212,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
# if this is a join with a 3pid signature, we may need to turn a 3pid
|
# if this is a join with a 3pid signature, we may need to turn a 3pid
|
||||||
# invite into a normal invite before we can handle the join.
|
# invite into a normal invite before we can handle the join.
|
||||||
if third_party_signed is not None:
|
if third_party_signed is not None:
|
||||||
replication = self.hs.get_replication_layer()
|
yield self.replication_layer.exchange_third_party_invite(
|
||||||
yield replication.exchange_third_party_invite(
|
|
||||||
third_party_signed["sender"],
|
third_party_signed["sender"],
|
||||||
target.to_string(),
|
target.to_string(),
|
||||||
room_id,
|
room_id,
|
||||||
|
@ -226,7 +233,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
requester.user,
|
requester.user,
|
||||||
)
|
)
|
||||||
if not is_requester_admin:
|
if not is_requester_admin:
|
||||||
if self.hs.config.block_non_admin_invites:
|
if self.config.block_non_admin_invites:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Blocking invite: user is not admin and non-admin "
|
"Blocking invite: user is not admin and non-admin "
|
||||||
"invites disabled"
|
"invites disabled"
|
||||||
|
@ -321,7 +328,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
else:
|
else:
|
||||||
# send the rejection to the inviter's HS.
|
# send the rejection to the inviter's HS.
|
||||||
remote_room_hosts = remote_room_hosts + [inviter.domain]
|
remote_room_hosts = remote_room_hosts + [inviter.domain]
|
||||||
fed_handler = self.hs.get_handlers().federation_handler
|
fed_handler = self.federation_handler
|
||||||
try:
|
try:
|
||||||
ret = yield fed_handler.do_remotely_reject_invite(
|
ret = yield fed_handler.do_remotely_reject_invite(
|
||||||
remote_room_hosts,
|
remote_room_hosts,
|
||||||
|
@ -477,7 +484,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
Raises:
|
Raises:
|
||||||
SynapseError if room alias could not be found.
|
SynapseError if room alias could not be found.
|
||||||
"""
|
"""
|
||||||
directory_handler = self.hs.get_handlers().directory_handler
|
directory_handler = self.directory_handler
|
||||||
mapping = yield directory_handler.get_association(room_alias)
|
mapping = yield directory_handler.get_association(room_alias)
|
||||||
|
|
||||||
if not mapping:
|
if not mapping:
|
||||||
|
@ -508,7 +515,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
requester,
|
requester,
|
||||||
txn_id
|
txn_id
|
||||||
):
|
):
|
||||||
if self.hs.config.block_non_admin_invites:
|
if self.config.block_non_admin_invites:
|
||||||
is_requester_admin = yield self.auth.is_server_admin(
|
is_requester_admin = yield self.auth.is_server_admin(
|
||||||
requester.user,
|
requester.user,
|
||||||
)
|
)
|
||||||
|
@ -555,7 +562,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
str: the matrix ID of the 3pid, or None if it is not recognized.
|
str: the matrix ID of the 3pid, or None if it is not recognized.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
data = yield self.hs.get_simple_http_client().get_json(
|
data = yield self.simple_http_client.get_json(
|
||||||
"%s%s/_matrix/identity/api/v1/lookup" % (id_server_scheme, id_server,),
|
"%s%s/_matrix/identity/api/v1/lookup" % (id_server_scheme, id_server,),
|
||||||
{
|
{
|
||||||
"medium": medium,
|
"medium": medium,
|
||||||
|
@ -578,7 +585,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
if server_hostname not in data["signatures"]:
|
if server_hostname not in data["signatures"]:
|
||||||
raise AuthError(401, "No signature from server %s" % (server_hostname,))
|
raise AuthError(401, "No signature from server %s" % (server_hostname,))
|
||||||
for key_name, signature in data["signatures"][server_hostname].items():
|
for key_name, signature in data["signatures"][server_hostname].items():
|
||||||
key_data = yield self.hs.get_simple_http_client().get_json(
|
key_data = yield self.simple_http_client.get_json(
|
||||||
"%s%s/_matrix/identity/api/v1/pubkey/%s" %
|
"%s%s/_matrix/identity/api/v1/pubkey/%s" %
|
||||||
(id_server_scheme, server_hostname, key_name,),
|
(id_server_scheme, server_hostname, key_name,),
|
||||||
)
|
)
|
||||||
|
@ -603,7 +610,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
user,
|
user,
|
||||||
txn_id
|
txn_id
|
||||||
):
|
):
|
||||||
room_state = yield self.hs.get_state_handler().get_current_state(room_id)
|
room_state = yield self.state_handler.get_current_state(room_id)
|
||||||
|
|
||||||
inviter_display_name = ""
|
inviter_display_name = ""
|
||||||
inviter_avatar_url = ""
|
inviter_avatar_url = ""
|
||||||
|
@ -727,15 +734,15 @@ class RoomMemberHandler(BaseHandler):
|
||||||
"sender_avatar_url": inviter_avatar_url,
|
"sender_avatar_url": inviter_avatar_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.hs.config.invite_3pid_guest:
|
if self.config.invite_3pid_guest:
|
||||||
registration_handler = self.hs.get_handlers().registration_handler
|
registration_handler = self.registration_handler
|
||||||
guest_access_token = yield registration_handler.guest_access_token_for(
|
guest_access_token = yield registration_handler.guest_access_token_for(
|
||||||
medium=medium,
|
medium=medium,
|
||||||
address=address,
|
address=address,
|
||||||
inviter_user_id=inviter_user_id,
|
inviter_user_id=inviter_user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
guest_user_info = yield self.hs.get_auth().get_user_by_access_token(
|
guest_user_info = yield self.auth.get_user_by_access_token(
|
||||||
guest_access_token
|
guest_access_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -744,7 +751,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
"guest_user_id": guest_user_info["user"].to_string(),
|
"guest_user_id": guest_user_info["user"].to_string(),
|
||||||
})
|
})
|
||||||
|
|
||||||
data = yield self.hs.get_simple_http_client().post_urlencoded_get_json(
|
data = yield self.simple_http_client.post_urlencoded_get_json(
|
||||||
is_url,
|
is_url,
|
||||||
invite_config
|
invite_config
|
||||||
)
|
)
|
||||||
|
|
|
@ -180,6 +180,7 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
||||||
self.handlers = hs.get_handlers()
|
self.handlers = hs.get_handlers()
|
||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
self.event_creation_handler = hs.get_event_creation_handler()
|
self.event_creation_handler = hs.get_event_creation_handler()
|
||||||
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_POST(self, request, room_id):
|
def on_POST(self, request, room_id):
|
||||||
|
@ -238,7 +239,7 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
||||||
logger.info("Kicking %r from %r...", user_id, room_id)
|
logger.info("Kicking %r from %r...", user_id, room_id)
|
||||||
|
|
||||||
target_requester = create_requester(user_id)
|
target_requester = create_requester(user_id)
|
||||||
yield self.handlers.room_member_handler.update_membership(
|
yield self.room_member_handler.update_membership(
|
||||||
requester=target_requester,
|
requester=target_requester,
|
||||||
target=target_requester.user,
|
target=target_requester.user,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
|
@ -247,9 +248,9 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
||||||
ratelimit=False
|
ratelimit=False
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.handlers.room_member_handler.forget(target_requester.user, room_id)
|
yield self.room_member_handler.forget(target_requester.user, room_id)
|
||||||
|
|
||||||
yield self.handlers.room_member_handler.update_membership(
|
yield self.room_member_handler.update_membership(
|
||||||
requester=target_requester,
|
requester=target_requester,
|
||||||
target=target_requester.user,
|
target=target_requester.user,
|
||||||
room_id=new_room_id,
|
room_id=new_room_id,
|
||||||
|
|
|
@ -84,6 +84,7 @@ class RoomStateEventRestServlet(ClientV1RestServlet):
|
||||||
super(RoomStateEventRestServlet, self).__init__(hs)
|
super(RoomStateEventRestServlet, self).__init__(hs)
|
||||||
self.handlers = hs.get_handlers()
|
self.handlers = hs.get_handlers()
|
||||||
self.event_creation_hander = hs.get_event_creation_handler()
|
self.event_creation_hander = hs.get_event_creation_handler()
|
||||||
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
|
|
||||||
def register(self, http_server):
|
def register(self, http_server):
|
||||||
# /room/$roomid/state/$eventtype
|
# /room/$roomid/state/$eventtype
|
||||||
|
@ -156,7 +157,7 @@ class RoomStateEventRestServlet(ClientV1RestServlet):
|
||||||
|
|
||||||
if event_type == EventTypes.Member:
|
if event_type == EventTypes.Member:
|
||||||
membership = content.get("membership", None)
|
membership = content.get("membership", None)
|
||||||
event = yield self.handlers.room_member_handler.update_membership(
|
event = yield self.room_member_handler.update_membership(
|
||||||
requester,
|
requester,
|
||||||
target=UserID.from_string(state_key),
|
target=UserID.from_string(state_key),
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
|
@ -229,7 +230,7 @@ class RoomSendEventRestServlet(ClientV1RestServlet):
|
||||||
class JoinRoomAliasServlet(ClientV1RestServlet):
|
class JoinRoomAliasServlet(ClientV1RestServlet):
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(JoinRoomAliasServlet, self).__init__(hs)
|
super(JoinRoomAliasServlet, self).__init__(hs)
|
||||||
self.handlers = hs.get_handlers()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
|
|
||||||
def register(self, http_server):
|
def register(self, http_server):
|
||||||
# /join/$room_identifier[/$txn_id]
|
# /join/$room_identifier[/$txn_id]
|
||||||
|
@ -257,7 +258,7 @@ class JoinRoomAliasServlet(ClientV1RestServlet):
|
||||||
except Exception:
|
except Exception:
|
||||||
remote_room_hosts = None
|
remote_room_hosts = None
|
||||||
elif RoomAlias.is_valid(room_identifier):
|
elif RoomAlias.is_valid(room_identifier):
|
||||||
handler = self.handlers.room_member_handler
|
handler = self.room_member_handler
|
||||||
room_alias = RoomAlias.from_string(room_identifier)
|
room_alias = RoomAlias.from_string(room_identifier)
|
||||||
room_id, remote_room_hosts = yield handler.lookup_room_alias(room_alias)
|
room_id, remote_room_hosts = yield handler.lookup_room_alias(room_alias)
|
||||||
room_id = room_id.to_string()
|
room_id = room_id.to_string()
|
||||||
|
@ -266,7 +267,7 @@ class JoinRoomAliasServlet(ClientV1RestServlet):
|
||||||
room_identifier,
|
room_identifier,
|
||||||
))
|
))
|
||||||
|
|
||||||
yield self.handlers.room_member_handler.update_membership(
|
yield self.room_member_handler.update_membership(
|
||||||
requester=requester,
|
requester=requester,
|
||||||
target=requester.user,
|
target=requester.user,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
|
@ -562,7 +563,7 @@ class RoomEventContextServlet(ClientV1RestServlet):
|
||||||
class RoomForgetRestServlet(ClientV1RestServlet):
|
class RoomForgetRestServlet(ClientV1RestServlet):
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(RoomForgetRestServlet, self).__init__(hs)
|
super(RoomForgetRestServlet, self).__init__(hs)
|
||||||
self.handlers = hs.get_handlers()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
|
|
||||||
def register(self, http_server):
|
def register(self, http_server):
|
||||||
PATTERNS = ("/rooms/(?P<room_id>[^/]*)/forget")
|
PATTERNS = ("/rooms/(?P<room_id>[^/]*)/forget")
|
||||||
|
@ -575,7 +576,7 @@ class RoomForgetRestServlet(ClientV1RestServlet):
|
||||||
allow_guest=False,
|
allow_guest=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.handlers.room_member_handler.forget(
|
yield self.room_member_handler.forget(
|
||||||
user=requester.user,
|
user=requester.user,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
)
|
)
|
||||||
|
@ -593,7 +594,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(RoomMembershipRestServlet, self).__init__(hs)
|
super(RoomMembershipRestServlet, self).__init__(hs)
|
||||||
self.handlers = hs.get_handlers()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
|
|
||||||
def register(self, http_server):
|
def register(self, http_server):
|
||||||
# /rooms/$roomid/[invite|join|leave]
|
# /rooms/$roomid/[invite|join|leave]
|
||||||
|
@ -622,7 +623,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
|
||||||
content = {}
|
content = {}
|
||||||
|
|
||||||
if membership_action == "invite" and self._has_3pid_invite_keys(content):
|
if membership_action == "invite" and self._has_3pid_invite_keys(content):
|
||||||
yield self.handlers.room_member_handler.do_3pid_invite(
|
yield self.room_member_handler.do_3pid_invite(
|
||||||
room_id,
|
room_id,
|
||||||
requester.user,
|
requester.user,
|
||||||
content["medium"],
|
content["medium"],
|
||||||
|
@ -644,7 +645,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
|
||||||
if 'reason' in content and membership_action in ['kick', 'ban']:
|
if 'reason' in content and membership_action in ['kick', 'ban']:
|
||||||
event_content = {'reason': content['reason']}
|
event_content = {'reason': content['reason']}
|
||||||
|
|
||||||
yield self.handlers.room_member_handler.update_membership(
|
yield self.room_member_handler.update_membership(
|
||||||
requester=requester,
|
requester=requester,
|
||||||
target=target,
|
target=target,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
|
|
|
@ -183,7 +183,7 @@ class RegisterRestServlet(RestServlet):
|
||||||
self.auth_handler = hs.get_auth_handler()
|
self.auth_handler = hs.get_auth_handler()
|
||||||
self.registration_handler = hs.get_handlers().registration_handler
|
self.registration_handler = hs.get_handlers().registration_handler
|
||||||
self.identity_handler = hs.get_handlers().identity_handler
|
self.identity_handler = hs.get_handlers().identity_handler
|
||||||
self.room_member_handler = hs.get_handlers().room_member_handler
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
self.device_handler = hs.get_device_handler()
|
self.device_handler = hs.get_device_handler()
|
||||||
self.macaroon_gen = hs.get_macaroon_generator()
|
self.macaroon_gen = hs.get_macaroon_generator()
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ from synapse.handlers.device import DeviceHandler
|
||||||
from synapse.handlers.e2e_keys import E2eKeysHandler
|
from synapse.handlers.e2e_keys import E2eKeysHandler
|
||||||
from synapse.handlers.presence import PresenceHandler
|
from synapse.handlers.presence import PresenceHandler
|
||||||
from synapse.handlers.room_list import RoomListHandler
|
from synapse.handlers.room_list import RoomListHandler
|
||||||
|
from synapse.handlers.room_member import RoomMemberHandler
|
||||||
from synapse.handlers.set_password import SetPasswordHandler
|
from synapse.handlers.set_password import SetPasswordHandler
|
||||||
from synapse.handlers.sync import SyncHandler
|
from synapse.handlers.sync import SyncHandler
|
||||||
from synapse.handlers.typing import TypingHandler
|
from synapse.handlers.typing import TypingHandler
|
||||||
|
@ -145,6 +146,7 @@ class HomeServer(object):
|
||||||
'groups_attestation_signing',
|
'groups_attestation_signing',
|
||||||
'groups_attestation_renewer',
|
'groups_attestation_renewer',
|
||||||
'spam_checker',
|
'spam_checker',
|
||||||
|
'room_member_handler',
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, hostname, **kwargs):
|
def __init__(self, hostname, **kwargs):
|
||||||
|
@ -382,6 +384,9 @@ class HomeServer(object):
|
||||||
def build_spam_checker(self):
|
def build_spam_checker(self):
|
||||||
return SpamChecker(self)
|
return SpamChecker(self)
|
||||||
|
|
||||||
|
def build_room_member_handler(self):
|
||||||
|
return RoomMemberHandler(self)
|
||||||
|
|
||||||
def remove_pusher(self, app_id, push_key, user_id):
|
def remove_pusher(self, app_id, push_key, user_id):
|
||||||
return self.get_pusherpool().remove_pusher(app_id, push_key, user_id)
|
return self.get_pusherpool().remove_pusher(app_id, push_key, user_id)
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class RoomTypingTestCase(RestTestCase):
|
||||||
else:
|
else:
|
||||||
if remotedomains is not None:
|
if remotedomains is not None:
|
||||||
remotedomains.add(member.domain)
|
remotedomains.add(member.domain)
|
||||||
hs.get_handlers().room_member_handler.fetch_room_distributions_into = (
|
hs.get_room_member_handler().fetch_room_distributions_into = (
|
||||||
fetch_room_distributions_into
|
fetch_room_distributions_into
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue