actions: Remove unused get_emails_from_user_ids function.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-08-13 18:10:48 -07:00
committed by Tim Abbott
parent 6ae5be6e75
commit 79f7f9b8d9
3 changed files with 0 additions and 18 deletions

View File

@@ -7285,11 +7285,6 @@ def do_update_linkifier(realm: Realm, id: int, pattern: str, url_format_string:
notify_linkifiers(realm)
def get_emails_from_user_ids(user_ids: Sequence[int]) -> Dict[int, str]:
# We may eventually use memcached to speed this up, but the DB is fast.
return UserProfile.emails_from_ids(user_ids)
def do_add_realm_domain(realm: Realm, domain: str, allow_subdomains: bool) -> (RealmDomain):
realm_domain = RealmDomain.objects.create(
realm=realm, domain=domain, allow_subdomains=allow_subdomains

View File

@@ -1744,11 +1744,6 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
dict(key=emojiset[0], text=emojiset[1]) for emojiset in UserProfile.EMOJISET_CHOICES
]
@staticmethod
def emails_from_ids(user_ids: Sequence[int]) -> Dict[int, str]:
rows = UserProfile.objects.filter(id__in=user_ids).values("id", "email")
return {row["id"]: row["email"] for row in rows}
def email_address_is_realm_public(self) -> bool:
if self.realm.email_address_visibility == Realm.EMAIL_ADDRESS_VISIBILITY_EVERYONE:
return True

View File

@@ -22,7 +22,6 @@ from zerver.lib.actions import (
do_mute_user,
do_reactivate_user,
do_set_realm_property,
get_emails_from_user_ids,
get_recipient_info,
)
from zerver.lib.avatar import avatar_url, get_gravatar_url
@@ -969,13 +968,6 @@ class AdminCreateUserTest(ZulipTestCase):
class UserProfileTest(ZulipTestCase):
def test_get_emails_from_user_ids(self) -> None:
hamlet = self.example_user("hamlet")
othello = self.example_user("othello")
dct = get_emails_from_user_ids([hamlet.id, othello.id])
self.assertEqual(dct[hamlet.id], hamlet.email)
self.assertEqual(dct[othello.id], othello.email)
def test_valid_user_id(self) -> None:
realm = get_realm("zulip")
hamlet = self.example_user("hamlet")