settings: Rearrange group settings in alphabetical order.

This commit is contained in:
Shubham Padia 2024-10-03 06:18:50 +00:00 committed by Tim Abbott
parent 72de37e737
commit 0634f75582
8 changed files with 49 additions and 49 deletions

View File

@ -483,12 +483,12 @@ const dropdown_widget_map = new Map<string, DropdownWidget | null>([
["realm_can_access_all_users_group", null],
["can_mention_group", null],
["realm_can_create_groups", null],
["realm_can_manage_all_groups", null],
["realm_can_create_public_channel_group", null],
["realm_can_create_private_channel_group", null],
["realm_can_create_web_public_channel_group", null],
["realm_can_delete_any_message_group", null],
["realm_can_delete_own_message_group", null],
["realm_can_manage_all_groups", null],
["realm_direct_message_initiator_group", null],
["realm_direct_message_permission_group", null],
]);
@ -808,12 +808,12 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea
case "realm_create_multiuse_invite_group":
case "realm_can_access_all_users_group":
case "realm_can_create_groups":
case "realm_can_manage_all_groups":
case "realm_can_create_public_channel_group":
case "realm_can_create_private_channel_group":
case "realm_can_create_web_public_channel_group":
case "realm_can_delete_any_message_group":
case "realm_can_delete_own_message_group":
case "realm_can_manage_all_groups":
case "realm_direct_message_initiator_group":
case "realm_direct_message_permission_group":
proposed_val = get_dropdown_list_widget_setting_value($elem);
@ -1046,10 +1046,10 @@ export function populate_data_for_realm_settings_request(
const realm_group_settings_using_new_api_format = new Set([
"can_create_groups",
"can_manage_all_groups",
"can_create_private_channel_group",
"can_create_public_channel_group",
"can_create_web_public_channel_group",
"can_manage_all_groups",
"can_delete_any_message_group",
"can_delete_own_message_group",
"direct_message_initiator_group",

View File

@ -511,12 +511,12 @@ export function discard_realm_property_element_changes(elem) {
case "realm_direct_message_permission_group":
case "realm_can_access_all_users_group":
case "realm_can_create_groups":
case "realm_can_manage_all_groups":
case "realm_can_create_public_channel_group":
case "realm_can_create_private_channel_group":
case "realm_can_create_web_public_channel_group":
case "realm_can_delete_any_message_group":
case "realm_can_delete_own_message_group":
case "realm_can_manage_all_groups":
settings_components.set_dropdown_list_widget_setting_value(
property_name,
property_value,

View File

@ -286,12 +286,12 @@ const realm_schema = z.object({
realm_bot_domain: z.string(),
realm_can_access_all_users_group: z.number(),
realm_can_create_groups: z.number(),
realm_can_manage_all_groups: z.number(),
realm_can_create_public_channel_group: z.number(),
realm_can_create_private_channel_group: z.number(),
realm_can_create_web_public_channel_group: z.number(),
realm_can_delete_any_message_group: z.number(),
realm_can_delete_own_message_group: z.number(),
realm_can_manage_all_groups: z.number(),
realm_create_multiuse_invite_group: z.number(),
realm_create_private_stream_policy: z.number(),
realm_date_created: z.number(),

View File

@ -1075,12 +1075,12 @@ group_setting_update_data_type = DictType(
("create_multiuse_invite_group", int),
("can_access_all_users_group", int),
("can_create_groups", group_setting_type),
("can_manage_all_groups", group_setting_type),
("can_create_public_channel_group", group_setting_type),
("can_create_private_channel_group", group_setting_type),
("can_create_web_public_channel_group", group_setting_type),
("can_delete_any_message_group", group_setting_type),
("can_delete_own_message_group", group_setting_type),
("can_manage_all_groups", group_setting_type),
("direct_message_initiator_group", group_setting_type),
("direct_message_permission_group", group_setting_type),
],

View File

@ -704,6 +704,15 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
id_field_name="can_access_all_users_group_id",
allowed_system_groups=[SystemGroups.EVERYONE, SystemGroups.MEMBERS],
),
can_create_groups=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=False,
allow_everyone_group=False,
default_group_name=SystemGroups.MEMBERS,
id_field_name="can_create_groups_id",
),
can_create_public_channel_group=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
@ -722,6 +731,21 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
default_group_name=SystemGroups.MEMBERS,
id_field_name="can_create_private_channel_group_id",
),
can_create_web_public_channel_group=GroupPermissionSetting(
require_system_group=True,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=True,
allow_everyone_group=False,
default_group_name=SystemGroups.OWNERS,
id_field_name="can_create_web_public_channel_group_id",
allowed_system_groups=[
SystemGroups.MODERATORS,
SystemGroups.ADMINISTRATORS,
SystemGroups.OWNERS,
SystemGroups.NOBODY,
],
),
can_delete_any_message_group=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
@ -740,6 +764,15 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
default_group_name=SystemGroups.EVERYONE,
id_field_name="can_delete_own_message_group_id",
),
can_manage_all_groups=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=False,
allow_everyone_group=False,
default_group_name=SystemGroups.OWNERS,
id_field_name="can_manage_all_groups_id",
),
direct_message_initiator_group=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
@ -758,51 +791,18 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
default_group_name=SystemGroups.EVERYONE,
id_field_name="direct_message_permission_group_id",
),
can_create_web_public_channel_group=GroupPermissionSetting(
require_system_group=True,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=True,
allow_everyone_group=False,
default_group_name=SystemGroups.OWNERS,
id_field_name="can_create_web_public_channel_group_id",
allowed_system_groups=[
SystemGroups.MODERATORS,
SystemGroups.ADMINISTRATORS,
SystemGroups.OWNERS,
SystemGroups.NOBODY,
],
),
can_create_groups=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=False,
allow_everyone_group=False,
default_group_name=SystemGroups.MEMBERS,
id_field_name="can_create_groups_id",
),
can_manage_all_groups=GroupPermissionSetting(
require_system_group=False,
allow_internet_group=False,
allow_owners_group=True,
allow_nobody_group=False,
allow_everyone_group=False,
default_group_name=SystemGroups.OWNERS,
id_field_name="can_manage_all_groups_id",
),
)
REALM_PERMISSION_GROUP_SETTINGS_WITH_NEW_API_FORMAT = [
"can_create_groups",
"can_create_private_channel_group",
"can_create_public_channel_group",
"can_create_web_public_channel_group",
"can_delete_any_message_group",
"can_delete_own_message_group",
"can_manage_all_groups",
"direct_message_initiator_group",
"direct_message_permission_group",
"can_create_groups",
"can_manage_all_groups",
]
DIGEST_WEEKDAY_VALUES = [0, 1, 2, 3, 4, 5, 6]
@ -1166,6 +1166,8 @@ def get_realm_with_settings(realm_id: int) -> Realm:
return Realm.objects.select_related(
"can_access_all_users_group",
"can_access_all_users_group__named_user_group",
"can_create_groups",
"can_create_groups__named_user_group",
"can_create_public_channel_group",
"can_create_public_channel_group__named_user_group",
"can_create_private_channel_group",
@ -1176,14 +1178,12 @@ def get_realm_with_settings(realm_id: int) -> Realm:
"can_delete_any_message_group__named_user_group",
"can_delete_own_message_group",
"can_delete_own_message_group__named_user_group",
"can_manage_all_groups",
"can_manage_all_groups__named_user_group",
"direct_message_initiator_group",
"direct_message_initiator_group__named_user_group",
"direct_message_permission_group",
"direct_message_permission_group__named_user_group",
"can_create_groups",
"can_create_groups__named_user_group",
"can_manage_all_groups",
"can_manage_all_groups__named_user_group",
"new_stream_announcements_stream",
"signup_announcements_stream",
"zulip_update_announcements_stream",

View File

@ -788,12 +788,12 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
if policy_name not in [
"add_custom_emoji_policy",
"can_create_groups",
"can_manage_all_groups",
"can_create_private_channel_group",
"can_create_public_channel_group",
"can_create_web_public_channel_group",
"can_delete_any_message_group",
"can_delete_own_message_group",
"can_manage_all_groups",
"create_multiuse_invite_group",
"direct_message_initiator_group",
"direct_message_permission_group",

View File

@ -131,12 +131,12 @@ class HomeTest(ZulipTestCase):
"realm_bots",
"realm_can_access_all_users_group",
"realm_can_create_groups",
"realm_can_manage_all_groups",
"realm_can_create_private_channel_group",
"realm_can_create_public_channel_group",
"realm_can_create_web_public_channel_group",
"realm_can_delete_any_message_group",
"realm_can_delete_own_message_group",
"realm_can_manage_all_groups",
"realm_create_multiuse_invite_group",
"realm_create_private_stream_policy",
"realm_create_public_stream_policy",

View File

@ -140,13 +140,13 @@ def update_realm(
digest_emails_enabled: Json[bool] | None = None,
message_content_allowed_in_email_notifications: Json[bool] | None = None,
bot_creation_policy: Json[BotCreationPolicyEnum] | None = None,
can_create_groups: Json[GroupSettingChangeRequest] | None = None,
can_create_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
can_create_private_channel_group: Json[GroupSettingChangeRequest] | None = None,
can_create_web_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
can_manage_all_groups: Json[GroupSettingChangeRequest] | None = None,
direct_message_initiator_group: Json[GroupSettingChangeRequest] | None = None,
direct_message_permission_group: Json[GroupSettingChangeRequest] | None = None,
can_create_groups: Json[GroupSettingChangeRequest] | None = None,
can_manage_all_groups: Json[GroupSettingChangeRequest] | None = None,
invite_to_stream_policy: Json[CommonPolicyEnum] | None = None,
move_messages_between_streams_policy: Json[MoveMessagesBetweenStreamsPolicyEnum] | None = None,
wildcard_mention_policy: Json[WildcardMentionPolicyEnum] | None = None,