state_data: Move group_setting_value_schema to types.ts.

This is needed to avoid import cycles in next commit.
This commit is contained in:
Sahil Batra 2024-11-15 20:16:02 +05:30 committed by Tim Abbott
parent fc7d305791
commit d2b29cef2d
4 changed files with 12 additions and 9 deletions

View File

@ -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";

View File

@ -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";

View File

@ -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<typeof group_setting_value_schema>;
export const raw_user_group_schema = z.object({

View File

@ -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]);