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.

invites: Use query.count() not len(query).

Alex Vandivera49111c89a9a
diff --git a/zerver/actions/invites.py b/zerver/actions/invites.py
index 0fa5cb9614f..829a88384c3 100644
--- a/zerver/actions/invites.py
+++ b/zerver/actions/invites.py
@@ -116,7 +116,9 @@ def too_many_recent_realm_invites(realm: Realm, num_invitees: int) -> bool:
if realm.date_created >= timezone_now() - timedelta(hours=1):
warning_flags.append("realm-created-in-last-hour")
- current_user_count = len(UserProfile.objects.filter(realm=realm, is_bot=False, is_active=True))
+ current_user_count = UserProfile.objects.filter(
+ realm=realm, is_bot=False, is_active=True
+ ).count()
if current_user_count == 1:
warning_flags.append("only-one-user")