Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/message_live_update.js to ES6 module.
Anders Kaseorga1e9be884d43
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 797ae34f332..c20e1cc670c 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -174,7 +174,6 @@"message_fetch": false,"message_flags": false,"message_list": false,- "message_live_update": false,"message_scroll": false,"message_store": false,"message_util": false,diff --git a/frontend_tests/node_tests/tutorial.js b/frontend_tests/node_tests/tutorial.jsindex 13b3a9b49b8..b19dd68ad39 100644--- a/frontend_tests/node_tests/tutorial.js+++ b/frontend_tests/node_tests/tutorial.js@@ -22,7 +22,8 @@ const {run_test} = require("../zjsunit/test");set_global("page_params", {});const activity = set_global("activity", {});-const message_live_update = set_global("message_live_update", {});+const message_live_update = {__esModule: true};+rewiremock("../../static/js/message_live_update").with(message_live_update);const pm_list = {__esModule: true};rewiremock("../../static/js/pm_list").with(pm_list);const settings_users = set_global("settings_users", {});diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.jsindex 2f6e6e4eb24..c0f96588a28 100644--- a/frontend_tests/node_tests/user_events.js+++ b/frontend_tests/node_tests/user_events.js@@ -51,7 +51,9 @@ const settings_account = set_global("settings_account", {update_full_name() {},});-const message_live_update = set_global("message_live_update", {});+const message_live_update = {__esModule: true};++rewiremock("../../static/js/message_live_update").with(message_live_update);rewiremock.enable();diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex dd4d75925e1..e7be778e88f 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -22,7 +22,6 @@ import "../unread";import "../stream_list";import "../widgetize";import "../message_list";-import "../message_live_update";import "../narrow_state";import "../narrow";import "../reload_state";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex b3a585c5136..589bd7aafe9 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -48,7 +48,6 @@ declare let message_events: any;declare let message_fetch: any;declare let message_flags: any;declare let message_list: any;-declare let message_live_update: any;declare let message_scroll: any;declare let message_store: any;declare let message_util: any;diff --git a/static/js/message_live_update.js b/static/js/message_live_update.jsindex d23d23b6d89..f471369a75b 100644--- a/static/js/message_live_update.js+++ b/static/js/message_live_update.js@@ -1,6 +1,4 @@-"use strict";--const people = require("./people");+import * as people from "./people";function rerender_messages_view() {for (const list of [home_msg_list, message_list.narrowed, message_list.all]) {@@ -13,21 +11,19 @@ function rerender_messages_view() {}}-exports.update_stream_name = function (stream_id, new_name) {+export function update_stream_name(stream_id, new_name) {message_store.update_property("stream_name", new_name, {stream_id});rerender_messages_view();-};+}-exports.update_user_full_name = function (user_id, full_name) {+export function update_user_full_name(user_id, full_name) {message_store.update_property("sender_full_name", full_name, {user_id});rerender_messages_view();-};+}-exports.update_avatar = function (user_id, avatar_url) {+export function update_avatar(user_id, avatar_url) {let url = avatar_url;url = people.format_small_avatar_url(url);message_store.update_property("small_avatar_url", url, {user_id});rerender_messages_view();-};--window.message_live_update = exports;+}diff --git a/static/js/subs.js b/static/js/subs.jsindex 45d93e3dbf9..7bc31fdf81e 100644--- a/static/js/subs.js+++ b/static/js/subs.js@@ -10,6 +10,7 @@ const render_subscriptions = require("../templates/subscriptions.hbs");const channel = require("./channel");const components = require("./components");const loading = require("./loading");+const message_live_update = require("./message_live_update");const people = require("./people");const scroll_util = require("./scroll_util");const search_util = require("./search_util");diff --git a/static/js/user_events.js b/static/js/user_events.jsindex 5d53f5fa650..f999469500c 100644--- a/static/js/user_events.js+++ b/static/js/user_events.js@@ -4,6 +4,7 @@// server_events.js simple while breaking some circular// dependencies that existed when this code was in people.js.// (We should do bot updates here too.)+const message_live_update = require("./message_live_update");const people = require("./people");const pm_list = require("./pm_list");const settings_config = require("./settings_config");