mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 15:31:20 +00:00
settings: Refactor code to update realm group based settings.
This commit refactors code such that we do not add separate if condition block for each realm group based settings using the new API format to send the request accordingly. We now use a single if-block to update the request data for realm group permission settings using new API format.
This commit is contained in:
@@ -971,18 +971,18 @@ export function populate_data_for_realm_settings_request(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_name === "can_create_public_channel_group") {
|
const realm_group_settings_using_new_api_format = new Set([
|
||||||
|
"can_create_private_channel_group",
|
||||||
|
"can_create_public_channel_group",
|
||||||
|
]);
|
||||||
|
if (realm_group_settings_using_new_api_format.has(property_name)) {
|
||||||
|
const old_value = get_realm_settings_property_value(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
|
("realm_" + property_name) as RealmSettingProperties,
|
||||||
|
);
|
||||||
data[property_name] = JSON.stringify({
|
data[property_name] = JSON.stringify({
|
||||||
new: input_value,
|
new: input_value,
|
||||||
old: realm.realm_can_create_public_channel_group,
|
old: old_value,
|
||||||
});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property_name === "can_create_private_channel_group") {
|
|
||||||
data[property_name] = JSON.stringify({
|
|
||||||
new: input_value,
|
|
||||||
old: realm.realm_can_create_private_channel_group,
|
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user