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.

zform: Move zod schema to avoid dependency cycle.

Varun Singh195bb4d13bc6
diff --git a/web/src/submessage.js b/web/src/submessage.js
index 5924c726d67..977640d9a9b 100644
--- a/web/src/submessage.js
+++ b/web/src/submessage.js
@@ -1,8 +1,23 @@
+import z from "zod";
+
import * as blueslip from "./blueslip";
import * as channel from "./channel";
import * as message_store from "./message_store";
import * as widgetize from "./widgetize";
+export const zform_widget_extra_data_schema = z.object({
+ choices: z.array(
+ z.object({
+ type: z.string(),
+ long_name: z.string(),
+ reply: z.string(),
+ short_name: z.string(),
+ }),
+ ),
+ heading: z.string(),
+ type: z.literal("choices"),
+});
+
export function get_message_events(message) {
if (message.locally_echoed) {
return undefined;
diff --git a/web/src/zform.js b/web/src/zform.js
index 77cdbef0cc8..1cbfa7953cd 100644
--- a/web/src/zform.js
+++ b/web/src/zform.js
@@ -1,24 +1,11 @@
import $ from "jquery";
-import {z} from "zod";
import render_widgets_zform_choices from "../templates/widgets/zform_choices.hbs";
import * as blueslip from "./blueslip";
+import {zform_widget_extra_data_schema} from "./submessage";
import * as transmit from "./transmit";
-const zform_widget_extra_data_schema = z.object({
- choices: z.array(
- z.object({
- type: z.string(),
- long_name: z.string(),
- reply: z.string(),
- short_name: z.string(),
- }),
- ),
- heading: z.string(),
- type: z.literal("choices"),
-});
-
export function activate(opts) {
const self = {};