settings: Clean schemas and types used for group settings.

Removed "type"/"Type" from schema and type names used
for group settings because we want to use "type"/"Type"
only for "type of a type" cases.

So, this commit renames-
- anonymous_group_type => anonymous_group_schema
- group_setting_type_schema => group_setting_value_schema
- GroupSettingType => GroupSettingValue

We also had duplicate definitions for GroupSettingType, in
state_data.ts and in settings_components.ts. So, removed it
from settings_components.ts.
This commit is contained in:
Sahil Batra
2024-10-11 16:36:58 +05:30
committed by Tim Abbott
parent 96abf2501a
commit 7db6de340f
5 changed files with 14 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ import {realm_user_settings_defaults} from "./realm_user_settings_defaults";
import * as scroll_util from "./scroll_util";
import * as settings_config from "./settings_config";
import * as settings_data from "./settings_data";
import type {CustomProfileField, group_setting_type_schema} from "./state_data";
import type {CustomProfileField, GroupSettingValue} from "./state_data";
import {current_user, realm} from "./state_data";
import * as stream_data from "./stream_data";
import type {StreamSubscription} from "./sub_store";
@@ -651,7 +651,7 @@ function get_input_type($input_elem: JQuery, input_type?: string): string {
export function get_input_element_value(
input_elem: HTMLElement,
input_type?: string,
): boolean | number | string | null | undefined | GroupSettingType {
): boolean | number | string | null | undefined | GroupSettingValue {
const $input_elem = $(input_elem);
input_type = get_input_type($input_elem, input_type);
let input_value;
@@ -882,7 +882,7 @@ export function check_stream_settings_property_changed(
export function get_group_setting_widget_value(
pill_widget: GroupSettingPillContainer,
): GroupSettingType {
): GroupSettingValue {
const setting_pills = pill_widget.items();
const direct_subgroups: number[] = [];
const direct_members: number[] = [];
@@ -1422,7 +1422,7 @@ export function get_group_setting_widget(setting_name: string): GroupSettingPill
export function set_group_setting_widget_value(
pill_widget: GroupSettingPillContainer,
property_value: GroupSettingType,
property_value: GroupSettingValue,
): void {
pill_widget.clear();
@@ -1447,8 +1447,6 @@ export function set_group_setting_widget_value(
}
}
export type GroupSettingType = z.output<typeof group_setting_type_schema>;
type group_setting_name = "can_manage_group" | "can_join_group";
export function create_group_setting_widget({