mirror of https://github.com/zulip/zulip.git
soft activation: Avoid QuerySet and use List instead.
This commit is contained in:
parent
0c44db5325
commit
890732a88f
|
@ -355,7 +355,7 @@ def get_users_for_soft_deactivation(
|
|||
return users_to_deactivate
|
||||
|
||||
|
||||
def do_soft_activate_users(users: Iterable[UserProfile]) -> List[UserProfile]:
|
||||
def do_soft_activate_users(users: List[UserProfile]) -> List[UserProfile]:
|
||||
users_soft_activated = []
|
||||
for user_profile in users:
|
||||
user_activated = reactivate_user_if_soft_deactivated(user_profile)
|
||||
|
|
|
@ -4,7 +4,6 @@ from typing import Any, Dict, List
|
|||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import CommandError
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.soft_deactivation import (
|
||||
|
@ -16,11 +15,9 @@ from zerver.lib.soft_deactivation import (
|
|||
from zerver.models import Realm, UserProfile
|
||||
|
||||
|
||||
def get_users_from_emails(
|
||||
emails: List[str], filter_kwargs: Dict[str, Realm]
|
||||
) -> QuerySet[UserProfile]:
|
||||
def get_users_from_emails(emails: List[str], filter_kwargs: Dict[str, Realm]) -> List[UserProfile]:
|
||||
# Bug: Ideally, this would be case-insensitive like our other email queries.
|
||||
users = UserProfile.objects.filter(delivery_email__in=emails, **filter_kwargs)
|
||||
users = list(UserProfile.objects.filter(delivery_email__in=emails, **filter_kwargs))
|
||||
|
||||
if len(users) != len(emails):
|
||||
user_emails_found = {user.delivery_email for user in users}
|
||||
|
|
Loading…
Reference in New Issue