This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Couldn't load subscription status.
- Fork 2.1k
async/await get_user_id_by_threepid #7620
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6e10ffa
Replace instances of reactor manipulation with get_success.
anoadragon453 6386fd0
get_registered_reserved_users, reap_monthly_active_users
anoadragon453 d089855
generate_monthly_active_users
anoadragon453 968e287
get_user_id_by_threepid
anoadragon453 f9a5111
changelog
anoadragon453 aed5691
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/asy…
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| import logging | ||
| import re | ||
| from typing import Optional | ||
|
|
||
| from six import iterkeys | ||
|
|
||
|
|
@@ -342,7 +343,7 @@ def is_real_user(self, user_id): | |
| ) | ||
| return res | ||
|
|
||
| @cachedInlineCallbacks() | ||
| @cached() | ||
| def is_support_user(self, user_id): | ||
| """Determines if the user is of type UserTypes.SUPPORT | ||
|
|
||
|
|
@@ -352,10 +353,9 @@ def is_support_user(self, user_id): | |
| Returns: | ||
| Deferred[bool]: True if user is of type UserTypes.SUPPORT | ||
| """ | ||
| res = yield self.db.runInteraction( | ||
| return self.db.runInteraction( | ||
| "is_support_user", self.is_support_user_txn, user_id | ||
| ) | ||
| return res | ||
|
|
||
| def is_real_user_txn(self, txn, user_id): | ||
| res = self.db.simple_select_one_onecol_txn( | ||
|
|
@@ -516,18 +516,17 @@ def _find_next_generated_user_id(txn): | |
| ) | ||
| ) | ||
|
|
||
| @defer.inlineCallbacks | ||
| def get_user_id_by_threepid(self, medium, address): | ||
| async def get_user_id_by_threepid(self, medium: str, address: str) -> Optional[str]: | ||
| """Returns user id from threepid | ||
|
|
||
| Args: | ||
| medium (str): threepid medium e.g. email | ||
| address (str): threepid address e.g. [email protected] | ||
| medium: threepid medium e.g. email | ||
| address: threepid address e.g. [email protected] | ||
|
|
||
| Returns: | ||
| Deferred[str|None]: user id or None if no user id/threepid mapping exists | ||
| The user ID or None if no user id/threepid mapping exists | ||
| """ | ||
| user_id = yield self.db.runInteraction( | ||
| user_id = await self.db.runInteraction( | ||
| "get_user_id_by_threepid", self.get_user_id_by_threepid_txn, medium, address | ||
| ) | ||
| return user_id | ||
|
|
@@ -993,7 +992,7 @@ def register_user( | |
|
|
||
| Args: | ||
| user_id (str): The desired user ID to register. | ||
| password_hash (str): Optional. The password hash for this user. | ||
| password_hash (str|None): Optional. The password hash for this user. | ||
| was_guest (bool): Optional. Whether this is a guest account being | ||
| upgraded to a non-guest account. | ||
| make_guest (boolean): True if the the new user should be guest, | ||
|
|
@@ -1007,6 +1006,9 @@ def register_user( | |
|
|
||
| Raises: | ||
| StoreError if the user_id could not be registered. | ||
|
|
||
| Returns: | ||
| Deferred | ||
| """ | ||
| return self.db.runInteraction( | ||
| "register_user", | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.