Fix joining from an invite

This commit is contained in:
Erik Johnston 2014-12-09 14:47:27 +00:00
parent aa3f66cf7f
commit 5eca288d28
4 changed files with 20 additions and 17 deletions

View file

@ -113,6 +113,20 @@ class BaseHandler(object):
yield self.store.persist_event(event, context=context)
federation_handler = self.hs.get_handlers().federation_handler
if event.type == EventTypes.Member:
if event.content["membership"] == Membership.INVITE:
invitee = self.hs.parse_userid(event.state_key)
if not self.hs.is_mine(invitee):
returned_invite = yield federation_handler.send_invite(
invitee.domain,
event,
)
event.signatures.update(
returned_invite.signatures
)
destinations = set(extra_destinations)
for k, s in context.current_state.items():
try:
@ -128,7 +142,6 @@ class BaseHandler(object):
yield self.notifier.on_new_room_event(event, extra_users=extra_users)
federation_handler = self.hs.get_handlers().federation_handler
yield federation_handler.handle_new_event(
event,
None,

View file

@ -282,8 +282,6 @@ class FederationHandler(BaseHandler):
pdu=event
)
defer.returnValue(pdu)
@defer.inlineCallbacks

View file

@ -429,12 +429,9 @@ class RoomMemberHandler(BaseHandler):
)
if prev_state and prev_state.membership == Membership.INVITE:
room = yield self.store.get_room(room_id)
inviter = UserID.from_string(
prev_state.user_id, self.hs
)
inviter = UserID.from_string(prev_state.user_id)
should_do_dance = not self.hs.is_mine(inviter) and not room
should_do_dance = not self.hs.is_mine(inviter)
room_host = inviter.domain
else:
should_do_dance = False
@ -511,14 +508,7 @@ class RoomMemberHandler(BaseHandler):
do_auth):
yield run_on_reactor()
# If we're inviting someone, then we should also send it to that
# HS.
target_user_id = event.state_key
target_user = self.hs.parse_userid(target_user_id)
if membership == Membership.INVITE and not self.hs.is_mine(target_user):
do_invite_host = target_user.domain
else:
do_invite_host = None
target_user = self.hs.parse_userid(event.state_key)
yield self.handle_new_client_event(
event,

View file

@ -166,13 +166,15 @@ class StateHandler(object):
prev_state
)
if hasattr(event, "auth_events"):
if hasattr(event, "auth_events") and event.auth_events:
auth_ids = zip(*event.auth_events)[0]
context.auth_events = {
k: v
for k, v in context.current_state.items()
if v.event_id in auth_ids
}
else:
context.auth_events = {}
defer.returnValue(prev_state)