diff --git a/web/src/settings_components.ts b/web/src/settings_components.ts index fae82b8598..2f2a02adc4 100644 --- a/web/src/settings_components.ts +++ b/web/src/settings_components.ts @@ -27,11 +27,12 @@ import * as scroll_util from "./scroll_util.ts"; import * as settings_config from "./settings_config.ts"; import * as settings_data from "./settings_data.ts"; import type {CustomProfileField, GroupSettingValue} from "./state_data.ts"; -import {current_user, group_setting_value_schema, realm, realm_schema} from "./state_data.ts"; +import {current_user, realm, realm_schema} from "./state_data.ts"; import * as stream_data from "./stream_data.ts"; import type {StreamSubscription} from "./sub_store.ts"; import {stream_subscription_schema} from "./sub_store.ts"; import type {GroupSettingPillContainer} from "./typeahead_helper.ts"; +import {group_setting_value_schema} from "./types.ts"; import type {HTMLSelectOneElement} from "./types.ts"; import * as user_group_pill from "./user_group_pill.ts"; import * as user_groups from "./user_groups.ts"; diff --git a/web/src/settings_org.ts b/web/src/settings_org.ts index 80782ddc59..157e65a9b8 100644 --- a/web/src/settings_org.ts +++ b/web/src/settings_org.ts @@ -35,10 +35,11 @@ import * as settings_notifications from "./settings_notifications.ts"; import * as settings_preferences from "./settings_preferences.ts"; import * as settings_realm_domains from "./settings_realm_domains.ts"; import * as settings_ui from "./settings_ui.ts"; -import {current_user, group_setting_value_schema, realm, realm_schema} from "./state_data.ts"; +import {current_user, realm, realm_schema} from "./state_data.ts"; import type {Realm} from "./state_data.ts"; import * as stream_settings_data from "./stream_settings_data.ts"; import type {StreamSubscription} from "./sub_store.ts"; +import {group_setting_value_schema} from "./types.ts"; import type {HTMLSelectOneElement} from "./types.ts"; import * as ui_report from "./ui_report.ts"; import * as user_groups from "./user_groups.ts"; diff --git a/web/src/state_data.ts b/web/src/state_data.ts index a828725c1c..77e5365fc5 100644 --- a/web/src/state_data.ts +++ b/web/src/state_data.ts @@ -7,6 +7,7 @@ import { never_subscribed_stream_schema, stream_schema, } from "./stream_types.ts"; +import {group_setting_value_schema} from "./types.ts"; import {user_settings_schema} from "./user_settings.ts"; import {user_status_schema} from "./user_status_types.ts"; @@ -127,13 +128,6 @@ export const server_emoji_schema = z.object({ export const realm_emoji_map_schema = z.record(server_emoji_schema); -export const anonymous_group_schema = z.object({ - direct_subgroups: z.array(z.number()), - direct_members: z.array(z.number()), -}); - -export const group_setting_value_schema = z.union([z.number(), anonymous_group_schema]); - export type GroupSettingValue = z.infer; export const raw_user_group_schema = z.object({ diff --git a/web/src/types.ts b/web/src/types.ts index 911687f94e..040435c3f2 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -53,3 +53,10 @@ export type UpdateMessageEvent = { }; export type HTMLSelectOneElement = HTMLSelectElement & {type: "select-one"}; + +export const anonymous_group_schema = z.object({ + direct_subgroups: z.array(z.number()), + direct_members: z.array(z.number()), +}); + +export const group_setting_value_schema = z.union([z.number(), anonymous_group_schema]);