@@ -2681,19 +2681,18 @@ async def on_exchange_third_party_invite_request(
26812681 member_handler = self .hs .get_room_member_handler ()
26822682 await member_handler .send_membership_event (None , event , context )
26832683
2684- @defer .inlineCallbacks
2685- def add_display_name_to_third_party_invite (
2684+ async def add_display_name_to_third_party_invite (
26862685 self , room_version , event_dict , event , context
26872686 ):
26882687 key = (
26892688 EventTypes .ThirdPartyInvite ,
26902689 event .content ["third_party_invite" ]["signed" ]["token" ],
26912690 )
26922691 original_invite = None
2693- prev_state_ids = yield context .get_prev_state_ids ()
2692+ prev_state_ids = await context .get_prev_state_ids ()
26942693 original_invite_id = prev_state_ids .get (key )
26952694 if original_invite_id :
2696- original_invite = yield self .store .get_event (
2695+ original_invite = await self .store .get_event (
26972696 original_invite_id , allow_none = True
26982697 )
26992698 if original_invite :
@@ -2714,14 +2713,13 @@ def add_display_name_to_third_party_invite(
27142713
27152714 builder = self .event_builder_factory .new (room_version , event_dict )
27162715 EventValidator ().validate_builder (builder )
2717- event , context = yield self .event_creation_handler .create_new_client_event (
2716+ event , context = await self .event_creation_handler .create_new_client_event (
27182717 builder = builder
27192718 )
27202719 EventValidator ().validate_new (event , self .config )
27212720 return (event , context )
27222721
2723- @defer .inlineCallbacks
2724- def _check_signature (self , event , context ):
2722+ async def _check_signature (self , event , context ):
27252723 """
27262724 Checks that the signature in the event is consistent with its invite.
27272725
@@ -2738,12 +2736,12 @@ def _check_signature(self, event, context):
27382736 signed = event .content ["third_party_invite" ]["signed" ]
27392737 token = signed ["token" ]
27402738
2741- prev_state_ids = yield context .get_prev_state_ids ()
2739+ prev_state_ids = await context .get_prev_state_ids ()
27422740 invite_event_id = prev_state_ids .get ((EventTypes .ThirdPartyInvite , token ))
27432741
27442742 invite_event = None
27452743 if invite_event_id :
2746- invite_event = yield self .store .get_event (invite_event_id , allow_none = True )
2744+ invite_event = await self .store .get_event (invite_event_id , allow_none = True )
27472745
27482746 if not invite_event :
27492747 raise AuthError (403 , "Could not find invite" )
@@ -2792,7 +2790,7 @@ def _check_signature(self, event, context):
27922790 raise
27932791 try :
27942792 if "key_validity_url" in public_key_object :
2795- yield self ._check_key_revocation (
2793+ await self ._check_key_revocation (
27962794 public_key , public_key_object ["key_validity_url" ]
27972795 )
27982796 except Exception :
@@ -2806,8 +2804,7 @@ def _check_signature(self, event, context):
28062804 last_exception = e
28072805 raise last_exception
28082806
2809- @defer .inlineCallbacks
2810- def _check_key_revocation (self , public_key , url ):
2807+ async def _check_key_revocation (self , public_key , url ):
28112808 """
28122809 Checks whether public_key has been revoked.
28132810
@@ -2821,7 +2818,7 @@ def _check_key_revocation(self, public_key, url):
28212818 for revocation.
28222819 """
28232820 try :
2824- response = yield self .http_client .get_json (url , {"public_key" : public_key })
2821+ response = await self .http_client .get_json (url , {"public_key" : public_key })
28252822 except Exception :
28262823 raise SynapseError (502 , "Third party certificate could not be checked" )
28272824 if "valid" not in response or not response ["valid" ]:
@@ -2916,8 +2913,7 @@ async def user_joined_room(self, user: UserID, room_id: str) -> None:
29162913 else :
29172914 user_joined_room (self .distributor , user , room_id )
29182915
2919- @defer .inlineCallbacks
2920- def get_room_complexity (self , remote_room_hosts , room_id ):
2916+ async def get_room_complexity (self , remote_room_hosts , room_id ):
29212917 """
29222918 Fetch the complexity of a remote room over federation.
29232919
@@ -2931,12 +2927,12 @@ def get_room_complexity(self, remote_room_hosts, room_id):
29312927 """
29322928
29332929 for host in remote_room_hosts :
2934- res = yield self .federation_client .get_room_complexity (host , room_id )
2930+ res = await self .federation_client .get_room_complexity (host , room_id )
29352931
29362932 # We got a result, return it.
29372933 if res :
2938- defer . returnValue ( res )
2934+ return res
29392935
29402936 # We fell off the bottom, couldn't get the complexity from anyone. Oh
29412937 # well.
2942- defer . returnValue ( None )
2938+ return None
0 commit comments