Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/zform.js to ES6 module.
Anders Kaseorgf66441adb2dd
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 06cb15ed2f7..c6aca9afbc7 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -306,7 +306,6 @@"vdom": false,"widgetize": false,"zcommand": false,- "zform": false,"zxcvbn": false}},diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.jsindex a0154e08d78..221e9bba29d 100644--- a/frontend_tests/node_tests/widgetize.js+++ b/frontend_tests/node_tests/widgetize.js@@ -8,7 +8,6 @@ const {make_zjquery} = require("../zjsunit/zjquery");set_global("$", make_zjquery());const poll_widget = set_global("poll_widget", {});-set_global("zform", {});set_global("document", "document-stub");const return_true = () => true;diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 42508040ca2..45e636e4281 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -43,7 +43,6 @@ import "../top_left_corner";import "../stream_list";import "../filter";import "../poll_widget";-import "../zform";import "../widgetize";import "../submessage";import "../fetch_status";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex 5c7d796cb41..ac5a271ac18 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -169,4 +169,3 @@ declare let user_status: any;declare let user_status_ui: any;declare let widgetize: any;declare let zcommand: any;-declare let zform: any;diff --git a/static/js/widgetize.js b/static/js/widgetize.jsindex dbbe342f387..6682a205dd7 100644--- a/static/js/widgetize.js+++ b/static/js/widgetize.js@@ -1,6 +1,7 @@"use strict";const todo_widget = require("./todo_widget");+const zform = require("./zform");const widgets = new Map([["poll", poll_widget],diff --git a/static/js/zform.js b/static/js/zform.jsindex 40f9989f658..c1c09803078 100644--- a/static/js/zform.js+++ b/static/js/zform.js@@ -1,10 +1,8 @@-"use strict";+import render_widgets_zform_choices from "../templates/widgets/zform_choices.hbs";-const render_widgets_zform_choices = require("../templates/widgets/zform_choices.hbs");+import * as schema from "./schema";-const schema = require("./schema");--exports.validate_extra_data = function (data) {+export function validate_extra_data(data) {function check(data) {function check_choice_data(data) {function check_choice_item(field_name, val) {@@ -40,15 +38,15 @@ exports.validate_extra_data = function (data) {}return true;-};+}-exports.activate = function (opts) {+export function activate(opts) {const self = {};const outer_elem = opts.elem;const data = opts.extra_data;- if (!exports.validate_extra_data(data)) {+ if (!validate_extra_data(data)) {// callee will log reason we failreturn undefined;}@@ -102,6 +100,4 @@ exports.activate = function (opts) {render();return self;-};--window.zform = exports;+}