diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index e5b880550e..7b310a1105 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -2426,11 +2426,8 @@ def get_status_dict(requesting_user_profile): def get_realm_user_dicts(user_profile): - # Due to our permission model, it is advantageous to find the admin users in bulk. - admins = user_profile.realm.get_admin_users() - admin_emails = set([up.email for up in admins]) return [{'email' : userdict['email'], - 'is_admin' : userdict['email'] in admin_emails, + 'is_admin' : userdict['is_realm_admin'], 'is_bot' : userdict['is_bot'], 'full_name' : userdict['full_name']} for userdict in get_active_user_dicts_in_realm(user_profile.realm)] diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py index eda6d268b1..facd942d0a 100644 --- a/zerver/lib/cache.py +++ b/zerver/lib/cache.py @@ -268,7 +268,7 @@ def cache_save_user_profile(user_profile): # type: (Any) -> None cache_set(user_profile_by_id_cache_key(user_profile.id), user_profile, timeout=3600*24*7) -active_user_dict_fields = ['id', 'full_name', 'short_name', 'email', 'is_bot'] +active_user_dict_fields = ['id', 'full_name', 'short_name', 'email', 'is_realm_admin', 'is_bot'] def active_user_dicts_in_realm_cache_key(realm): # type: (Any) -> str return "active_user_dicts_in_realm:%s" % (realm.id,)