Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/stream_create.js to ES6 module.
Anders Kaseorg03f61c1eb23a
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 6fade139bbf..cc8cfc65297 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -263,7 +263,6 @@"spoilers": false,"starred_messages": false,"stream_color": false,- "stream_create": false,"stream_data": false,"stream_edit": false,"stream_events": false,diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 4f27936bd2b..6d45d0db8b8 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -69,7 +69,6 @@ import "../stream_data";import "../stream_topic_history";import "../stream_muting";import "../stream_events";-import "../stream_create";import "../stream_edit";import "../subs";import "../message_edit";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex 133d8bf78eb..6c2e6698e6b 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -130,7 +130,6 @@ declare let settings_user_groups: any;declare let settings_users: any;declare let starred_messages: any;declare let stream_color: any;-declare let stream_create: any;declare let stream_data: any;declare let stream_edit: any;declare let stream_events: any;diff --git a/static/js/stream_create.js b/static/js/stream_create.jsindex 18390dec8d3..d6212d31235 100644--- a/static/js/stream_create.js+++ b/static/js/stream_create.js@@ -1,25 +1,23 @@-"use strict";+import render_announce_stream_docs from "../templates/announce_stream_docs.hbs";+import render_new_stream_users from "../templates/new_stream_users.hbs";+import render_subscription_invites_warning_modal from "../templates/subscription_invites_warning_modal.hbs";-const render_announce_stream_docs = require("../templates/announce_stream_docs.hbs");-const render_new_stream_users = require("../templates/new_stream_users.hbs");-const render_subscription_invites_warning_modal = require("../templates/subscription_invites_warning_modal.hbs");--const peer_data = require("./peer_data");-const people = require("./people");+import * as peer_data from "./peer_data";+import * as people from "./people";let created_stream;-exports.reset_created_stream = function () {+export function reset_created_stream() {created_stream = undefined;-};+}-exports.set_name = function (stream) {+export function set_name(stream) {created_stream = stream;-};+}-exports.get_name = function () {+export function get_name() {return created_stream;-};+}class StreamSubscriptionError {report_no_subs_to_stream() {@@ -234,7 +232,7 @@ function create_stream() {});}-exports.new_stream_clicked = function (stream_name) {+export function new_stream_clicked(stream_name) {// this changes the tab switcher (settings/preview) which isn't necessary// to a add new stream title.subs.show_subs_pane.create_stream();@@ -243,9 +241,9 @@ exports.new_stream_clicked = function (stream_name) {if (stream_name !== "") {$("#create_stream_name").val(stream_name);}- exports.show_new_stream_modal();+ show_new_stream_modal();$("#create_stream_name").trigger("focus");-};+}function clear_error_display() {stream_name_error.clear_errors();@@ -253,7 +251,7 @@ function clear_error_display() {stream_subscription_error.clear_errors();}-exports.show_new_stream_modal = function () {+export function show_new_stream_modal() {$("#stream-creation").removeClass("hide");$(".right .settings").hide();@@ -270,7 +268,7 @@ exports.show_new_stream_modal = function () {const container = $("#people_to_add");container.html(html);- exports.create_handlers_for_users(container);+ create_handlers_for_users(container);// Make the options default to the same each time:// public, "announce stream" on.@@ -304,9 +302,9 @@ exports.show_new_stream_modal = function () {e.preventDefault();});-};+}-exports.create_handlers_for_users = function (container) {+export function create_handlers_for_users(container) {// container should be $('#people_to_add')...see caller to verifycontainer.on("change", "#user-checkboxes input", update_announce_stream_state);@@ -380,9 +378,9 @@ exports.create_handlers_for_users = function (container) {e.preventDefault();});-};+}-exports.set_up_handlers = function () {+export function set_up_handlers() {const container = $("#stream-creation").expectOne();container.on("change", "#make-invite-only input", update_announce_stream_state);@@ -466,6 +464,4 @@ exports.set_up_handlers = function () {e.preventDefault();}});-};--window.stream_create = exports;+}diff --git a/static/js/subs.js b/static/js/subs.jsindex 3701b36bd59..77b12a81678 100644--- a/static/js/subs.js+++ b/static/js/subs.js@@ -10,6 +10,7 @@ const render_subscriptions = require("../templates/subscriptions.hbs");const components = require("./components");const people = require("./people");const search_util = require("./search_util");+const stream_create = require("./stream_create");const util = require("./util");exports.show_subs_pane = {