diff --git a/analytics/views/stats.py b/analytics/views/stats.py index dad1a67b9c..868619b1a9 100644 --- a/analytics/views/stats.py +++ b/analytics/views/stats.py @@ -485,9 +485,7 @@ def sort_by_totals(value_arrays: Dict[str, List[int]]) -> List[str]: def sort_client_labels(data: Dict[str, Dict[str, List[int]]]) -> List[str]: realm_order = sort_by_totals(data["everyone"]) user_order = sort_by_totals(data["user"]) - label_sort_values: Dict[str, float] = {} - for i, label in enumerate(realm_order): - label_sort_values[label] = i + label_sort_values: Dict[str, float] = {label: i for i, label in enumerate(realm_order)} for i, label in enumerate(user_order): label_sort_values[label] = min(i - 0.1, label_sort_values.get(label, i)) return [label for label, sort_value in sorted(label_sort_values.items(), key=lambda x: x[1])] diff --git a/zerver/lib/user_groups.py b/zerver/lib/user_groups.py index b27f0194ad..281cf7662e 100644 --- a/zerver/lib/user_groups.py +++ b/zerver/lib/user_groups.py @@ -554,20 +554,8 @@ def get_system_user_group_for_user(user_profile: UserProfile) -> UserGroup: def get_server_supported_permission_settings() -> ServerSupportedPermissionSettings: - realm_permission_group_settings: Dict[str, GroupPermissionSetting] = {} - for permission_name, permission_config in Realm.REALM_PERMISSION_GROUP_SETTINGS.items(): - realm_permission_group_settings[permission_name] = permission_config - - stream_permission_group_settings: Dict[str, GroupPermissionSetting] = {} - for permission_name, permission_config in Stream.stream_permission_group_settings.items(): - stream_permission_group_settings[permission_name] = permission_config - - group_permission_settings: Dict[str, GroupPermissionSetting] = {} - for permission_name, permission_config in UserGroup.GROUP_PERMISSION_SETTINGS.items(): - group_permission_settings[permission_name] = permission_config - return ServerSupportedPermissionSettings( - realm=realm_permission_group_settings, - stream=stream_permission_group_settings, - group=group_permission_settings, + realm=Realm.REALM_PERMISSION_GROUP_SETTINGS, + stream=Stream.stream_permission_group_settings, + group=UserGroup.GROUP_PERMISSION_SETTINGS, )