Inline _do_local_membership_update

This commit is contained in:
Daniel Wagner-Hall 2016-02-15 16:02:22 +00:00
parent f318d4f2a4
commit 73e616df2a
1 changed files with 7 additions and 18 deletions

View File

@ -24,7 +24,6 @@ from synapse.api.constants import (
) )
from synapse.api.errors import AuthError, StoreError, SynapseError, Codes from synapse.api.errors import AuthError, StoreError, SynapseError, Codes
from synapse.util import stringutils, unwrapFirstError from synapse.util import stringutils, unwrapFirstError
from synapse.util.async import run_on_reactor
from synapse.util.logcontext import preserve_context_over_fn from synapse.util.logcontext import preserve_context_over_fn
from signedjson.sign import verify_signed_json from signedjson.sign import verify_signed_json
@ -466,6 +465,7 @@ class RoomMemberHandler(BaseHandler):
SynapseError if there was a problem changing the membership. SynapseError if there was a problem changing the membership.
""" """
target_user_id = event.state_key target_user_id = event.state_key
target_user = UserID.from_string(event.state_key)
prev_state = context.current_state.get( prev_state = context.current_state.get(
(EventTypes.Member, target_user_id), (EventTypes.Member, target_user_id),
@ -523,9 +523,10 @@ class RoomMemberHandler(BaseHandler):
else: else:
logger.debug("Doing normal join") logger.debug("Doing normal join")
yield self._do_local_membership_update( yield self.handle_new_client_event(
event, event,
context=context, context,
extra_users=[target_user],
ratelimit=ratelimit, ratelimit=ratelimit,
) )
@ -560,9 +561,10 @@ class RoomMemberHandler(BaseHandler):
defer.returnValue({}) defer.returnValue({})
return return
yield self._do_local_membership_update( yield self.handle_new_client_event(
event, event,
context=context, context,
extra_users=[target_user],
ratelimit=ratelimit, ratelimit=ratelimit,
) )
@ -650,19 +652,6 @@ class RoomMemberHandler(BaseHandler):
defer.returnValue(room_ids) defer.returnValue(room_ids)
@defer.inlineCallbacks
def _do_local_membership_update(self, event, context, ratelimit=True):
yield run_on_reactor()
target_user = UserID.from_string(event.state_key)
yield self.handle_new_client_event(
event,
context,
extra_users=[target_user],
ratelimit=ratelimit,
)
@defer.inlineCallbacks @defer.inlineCallbacks
def do_3pid_invite( def do_3pid_invite(
self, self,