Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
realm_user_count_by_role: Use strings as dict keys.
Anders Kaseorgb250e42f61c5
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 281453c6ebe..cd082dec78d 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -294,13 +294,13 @@ def realm_user_count(realm: Realm) -> int:return UserProfile.objects.filter(realm=realm, is_active=True, is_bot=False).count()def realm_user_count_by_role(realm: Realm) -> Dict[str, Any]:- human_counts = {UserProfile.ROLE_REALM_ADMINISTRATOR: 0,- UserProfile.ROLE_REALM_OWNER: 0,- UserProfile.ROLE_MEMBER: 0,- UserProfile.ROLE_GUEST: 0}+ human_counts = {str(UserProfile.ROLE_REALM_ADMINISTRATOR): 0,+ str(UserProfile.ROLE_REALM_OWNER): 0,+ str(UserProfile.ROLE_MEMBER): 0,+ str(UserProfile.ROLE_GUEST): 0}for value_dict in list(UserProfile.objects.filter(realm=realm, is_bot=False, is_active=True).values('role').annotate(Count('role'))):- human_counts[value_dict['role']] = value_dict['role__count']+ human_counts[str(value_dict['role'])] = value_dict['role__count']bot_count = UserProfile.objects.filter(realm=realm, is_bot=True, is_active=True).count()return {RealmAuditLog.ROLE_COUNT_HUMANS: human_counts,