Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stream_events: Extract updatable_stream_properties_schema.

Anders Kaseorg20c3a564a73e
diff --git a/web/src/stream_events.ts b/web/src/stream_events.ts
index 561fc989eab..3d053d93318 100644
--- a/web/src/stream_events.ts
+++ b/web/src/stream_events.ts
@@ -29,7 +29,10 @@ import * as stream_list from "./stream_list.ts";
import * as stream_muting from "./stream_muting.ts";
import * as stream_settings_api from "./stream_settings_api.ts";
import * as stream_settings_ui from "./stream_settings_ui.ts";
-import {stream_permission_group_settings_schema} from "./stream_types.ts";
+import {
+ type UpdatableStreamProperties,
+ stream_permission_group_settings_schema,
+} from "./stream_types.ts";
import * as sub_store from "./sub_store.ts";
import type {StreamSubscription} from "./sub_store.ts";
import {group_setting_value_schema} from "./types.ts";
@@ -62,8 +65,6 @@ function update_stream_setting(
sub[setting] = value;
}
-type UpdatableStreamProperties = sub_store.ApiStreamSubscription & {in_home_view: boolean};
-
export function update_property<P extends keyof UpdatableStreamProperties>(
stream_id: number,
property: P,
diff --git a/web/src/stream_types.ts b/web/src/stream_types.ts
index d7b1325bc1c..86bf1058615 100644
--- a/web/src/stream_types.ts
+++ b/web/src/stream_types.ts
@@ -69,3 +69,8 @@ export const api_stream_subscription_schema = api_stream_schema
.extend({
subscribers: z.array(z.number()).optional(),
});
+
+export const updatable_stream_properties_schema = api_stream_subscription_schema.extend({
+ in_home_view: z.boolean(),
+});
+export type UpdatableStreamProperties = z.infer<typeof updatable_stream_properties_schema>;