Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Small refactor of the fix for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Jun 15, 2020
1 parent 44361d3 commit 1263968
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def register(self, localpart, displayname=None, emails=[]):
"Using deprecated ModuleApi.register which creates a dummy user device."
)
user_id = yield self.register_user(localpart, displayname, emails)
_, access_token = yield defer.ensureDeferred(self.register_device(user_id))
_, access_token = yield self.register_device(user_id)
return user_id, access_token

def register_user(self, localpart, displayname=None, emails=[]):
Expand All @@ -126,7 +126,7 @@ def register_user(self, localpart, displayname=None, emails=[]):
'errcode' property for more information on the reason for failure
Returns:
Deferred[str]: user_id
defer.Deferred[str]: user_id
"""
return defer.ensureDeferred(
self._hs.get_registration_handler().register_user(
Expand All @@ -149,10 +149,12 @@ def register_device(self, user_id, device_id=None, initial_display_name=None):
Returns:
defer.Deferred[tuple[str, str]]: Tuple of device ID and access token
"""
return self._hs.get_registration_handler().register_device(
user_id=user_id,
device_id=device_id,
initial_display_name=initial_display_name,
return defer.ensureDeferred(
self._hs.get_registration_handler().register_device(
user_id=user_id,
device_id=device_id,
initial_display_name=initial_display_name,
)
)

def record_user_external_id(
Expand Down

0 comments on commit 1263968

Please sign in to comment.