Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/invite.js to ES6 module.
Anders Kaseorgf3af16db3f6e
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 9899939c6f1..857e1e216da 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -179,7 +179,6 @@"i18n": false,"info_overlay": false,"input_pill": false,- "invite": false,"jQuery": false,"keydown_util": false,"lightbox": false,diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.jsindex 980dd69fb1e..ea477c8ba81 100644--- a/frontend_tests/node_tests/ui_init.js+++ b/frontend_tests/node_tests/ui_init.js@@ -93,7 +93,6 @@ zrequire("condense");zrequire("spoilers");zrequire("lightbox");zrequire("overlays");-zrequire("invite");zrequire("message_view_header");zrequire("narrow_state");zrequire("presence");diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 1fbeb72aa3d..9e6177791a6 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -101,7 +101,6 @@ import "../hotkey";import "../notifications";import "../hash_util";import "../hashchange";-import "../invite";import "../message_flags";import "../starred_messages";import "../alert_words";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex d01cf00bca1..38a3e4b7765 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -51,7 +51,6 @@ declare let hotspots: any;declare let i18n: any;declare let info_overlay: any;declare let input_pill: any;-declare let invite: any;declare let keydown_util: any;declare let lightbox: any;declare let list_util: any;diff --git a/static/js/hashchange.js b/static/js/hashchange.jsindex 52b61123606..393d78abbd6 100644--- a/static/js/hashchange.js+++ b/static/js/hashchange.js@@ -1,5 +1,7 @@"use strict";+const invite = require("./invite");+// Read https://zulip.readthedocs.io/en/latest/subsystems/hashchange-system.html// or locally: docs/subsystems/hashchange-system.mdlet changing_hash = false;diff --git a/static/js/invite.js b/static/js/invite.jsindex 7c1f92001ba..4d2a62eb3b7 100644--- a/static/js/invite.js+++ b/static/js/invite.js@@ -1,12 +1,10 @@-"use strict";+import autosize from "autosize";+import ClipboardJS from "clipboard";-const autosize = require("autosize");-const ClipboardJS = require("clipboard");--const copy_invite_link = require("../templates/copy_invite_link.hbs");-const render_invitation_failed_error = require("../templates/invitation_failed_error.hbs");-const render_invite_subscription = require("../templates/invite_subscription.hbs");-const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs");+import copy_invite_link from "../templates/copy_invite_link.hbs";+import render_invitation_failed_error from "../templates/invitation_failed_error.hbs";+import render_invite_subscription from "../templates/invite_subscription.hbs";+import render_settings_dev_env_email_access from "../templates/settings/dev_env_email_access.hbs";function reset_error_messages() {$("#invite_status").hide().text("").removeClass(common.status_classes);@@ -130,7 +128,7 @@ function generate_multiuse_invite() {});}-exports.get_invite_streams = function () {+export function get_invite_streams() {const streams = stream_data.get_invite_stream_data();function compare_streams(a, b) {@@ -138,11 +136,11 @@ exports.get_invite_streams = function () {}streams.sort(compare_streams);return streams;-};+}function update_subscription_checkboxes() {const data = {- streams: exports.get_invite_streams(),+ streams: get_invite_streams(),notifications_stream: stream_data.get_notifications_stream(),};const html = render_invite_subscription(data);@@ -154,7 +152,7 @@ function prepare_form_to_be_shown() {reset_error_messages();}-exports.launch = function () {+export function launch() {$("#submit-invitation").button();prepare_form_to_be_shown();@@ -174,9 +172,9 @@ exports.launch = function () {submit_invitation_form();}});-};+}-exports.initialize = function () {+export function initialize() {$(document).on("click", "#invite_check_all_button", () => {$("#streams_to_add :checkbox").prop("checked", true);});@@ -212,6 +210,4 @@ exports.initialize = function () {$("#invite-method-choice").show();reset_error_messages();});-};--window.invite = exports;+}diff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex 01af6d11096..759389c1f47 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -11,6 +11,7 @@ const render_edit_content_button = require("../templates/edit_content_button.hbsconst copy_and_paste = require("./copy_and_paste");const echo = require("./echo");const emojisets = require("./emojisets");+const invite = require("./invite");const markdown_config = require("./markdown_config");const people = require("./people");const pm_conversations = require("./pm_conversations");