users: Fix TypedDict name for get_accounts_for_email return.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-07-31 14:15:51 -07:00 committed by Anders Kaseorg
parent 2893685890
commit c419c6369e
2 changed files with 5 additions and 5 deletions

View File

@ -289,14 +289,14 @@ def access_user_by_email(
return access_user_common(target, user_profile, allow_deactivated, allow_bots, for_admin) return access_user_common(target, user_profile, allow_deactivated, allow_bots, for_admin)
class Accounts(TypedDict): class Account(TypedDict):
realm_name: str realm_name: str
realm_id: int realm_id: int
full_name: str full_name: str
avatar: Optional[str] avatar: Optional[str]
def get_accounts_for_email(email: str) -> List[Accounts]: def get_accounts_for_email(email: str) -> List[Account]:
profiles = ( profiles = (
UserProfile.objects.select_related("realm") UserProfile.objects.select_related("realm")
.filter( .filter(
@ -307,7 +307,7 @@ def get_accounts_for_email(email: str) -> List[Accounts]:
) )
.order_by("date_joined") .order_by("date_joined")
) )
accounts: List[Accounts] = [] accounts: List[Account] = []
for profile in profiles: for profile in profiles:
accounts.append( accounts.append(
dict( dict(

View File

@ -49,7 +49,7 @@ from zerver.lib.test_helpers import (
from zerver.lib.upload import upload_avatar_image from zerver.lib.upload import upload_avatar_image
from zerver.lib.user_groups import get_system_user_group_for_user from zerver.lib.user_groups import get_system_user_group_for_user
from zerver.lib.users import ( from zerver.lib.users import (
Accounts, Account,
access_user_by_id, access_user_by_id,
get_accounts_for_email, get_accounts_for_email,
get_cross_realm_dicts, get_cross_realm_dicts,
@ -1110,7 +1110,7 @@ class UserProfileTest(ZulipTestCase):
def test_get_accounts_for_email(self) -> None: def test_get_accounts_for_email(self) -> None:
reset_email_visibility_to_everyone_in_zulip_realm() reset_email_visibility_to_everyone_in_zulip_realm()
def check_account_present_in_accounts(user: UserProfile, accounts: List[Accounts]) -> None: def check_account_present_in_accounts(user: UserProfile, accounts: List[Account]) -> None:
for account in accounts: for account in accounts:
realm = user.realm realm = user.realm
if ( if (