Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

actions: Remove unused get_emails_from_user_ids function.

Anders Kaseorg79f7f9b8d927
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index 6b31e4b3791..e82af0d5cc9 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -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
diff --git a/zerver/models.py b/zerver/models.py
index b797e4e1ab9..e354f0d5f7c 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -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
diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py
index eaaff09410c..4163aa85a9b 100644
--- a/zerver/tests/test_users.py
+++ b/zerver/tests/test_users.py
@@ -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")