Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/message_store.js to ES6 module.
Anders Kaseorg7145cb4a0dc1
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 76ee6d05461..f34796f23d0 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -154,7 +154,6 @@"message_events": false,"message_fetch": false,"message_list": false,- "message_store": false,"message_util": false,"narrow": false,"padded_widget": false,diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.jsindex 13697fe4551..ed682dc789d 100644--- a/frontend_tests/node_tests/composebox_typeahead.js+++ b/frontend_tests/node_tests/composebox_typeahead.js@@ -14,9 +14,12 @@ const stream_topic_history = {__esModule: true};rewiremock("../../static/js/stream_topic_history").with(stream_topic_history);-const message_store = set_global("message_store", {+const message_store = {+ __esModule: true,user_ids: () => [],-});+};++rewiremock("../../static/js/message_store").with(message_store);const page_params = set_global("page_params", {});const channel = {__esModule: true};diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.jsindex 23d8c72fbee..de9240ea4ac 100644--- a/frontend_tests/node_tests/echo.js+++ b/frontend_tests/node_tests/echo.js@@ -30,7 +30,7 @@ rewiremock("../../static/js/sent_messages").with({},});-set_global("message_store", {+rewiremock("../../static/js/message_store").with({get: () => ({failed_request: true}),update_booleans: () => {},});diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.jsindex 8d3cc525ac6..0828b4cf43d 100644--- a/frontend_tests/node_tests/filter.js+++ b/frontend_tests/node_tests/filter.js@@ -2,13 +2,18 @@const {strict: assert} = require("assert");+const rewiremock = require("rewiremock/node");+const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");const $ = require("../zjsunit/zjquery");-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};+rewiremock("../../static/js/message_store").with(message_store);const page_params = set_global("page_params", {});+rewiremock.enable();+zrequire("unread");const stream_data = zrequire("stream_data");const people = zrequire("people");@@ -1553,3 +1558,4 @@ run_test("error_cases", () => {const predicate = get_predicate([["pm-with", "[email protected]"]]);assert(!predicate({type: "private"}));});+rewiremock.disable();diff --git a/frontend_tests/node_tests/lightbox.js b/frontend_tests/node_tests/lightbox.jsindex 07ec434ce12..b388b4a6a5c 100644--- a/frontend_tests/node_tests/lightbox.js+++ b/frontend_tests/node_tests/lightbox.js@@ -22,7 +22,9 @@ rewiremock.enable();const rows = zrequire("rows");const lightbox = zrequire("lightbox");-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};++rewiremock("../../static/js/message_store").with(message_store);rows.__Rewire__("is_draft_row", () => false);diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.jsindex 3e0d13d9a38..ab31be1af8a 100644--- a/frontend_tests/node_tests/markdown.js+++ b/frontend_tests/node_tests/markdown.js@@ -39,7 +39,6 @@ const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");const markdown_config = zrequire("markdown_config");const marked = zrequire("marked", "third/marked/lib/marked");const markdown = zrequire("markdown");-zrequire("message_store");const people = zrequire("people");const stream_data = zrequire("stream_data");const user_groups = zrequire("user_groups");diff --git a/frontend_tests/node_tests/markdown_katex.js b/frontend_tests/node_tests/markdown_katex.jsindex b2df1eb0ef1..c1c253567d7 100644--- a/frontend_tests/node_tests/markdown_katex.js+++ b/frontend_tests/node_tests/markdown_katex.js@@ -22,7 +22,6 @@ rewiremock("katex").with({rewiremock.enable();const markdown_config = zrequire("markdown_config");-zrequire("message_store");const markdown = zrequire("markdown");diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.jsindex 636fd6bdc71..bd4c20eaa8b 100644--- a/frontend_tests/node_tests/message_fetch.js+++ b/frontend_tests/node_tests/message_fetch.js@@ -40,7 +40,8 @@ rewiremock("../../static/js/message_scroll").with({update_top_of_narrow_notices: () => {},});const message_util = set_global("message_util", {});-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};+rewiremock("../../static/js/message_store").with(message_store);const narrow_state = {__esModule: true};rewiremock("../../static/js/narrow_state").with(narrow_state);const pm_list = {__esModule: true};diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.jsindex f18c3747245..982d7628e8a 100644--- a/frontend_tests/node_tests/narrow_unread.js+++ b/frontend_tests/node_tests/narrow_unread.js@@ -7,7 +7,8 @@ const rewiremock = require("rewiremock/node");const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};+rewiremock("../../static/js/message_store").with(message_store);set_global("page_params", {});rewiremock("../../static/js/muting").with({diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.jsindex cc9a9bd2ede..f41bcd32974 100644--- a/frontend_tests/node_tests/people.js+++ b/frontend_tests/node_tests/people.js@@ -5,13 +5,17 @@ const {strict: assert} = require("assert");const {parseISO} = require("date-fns");const _ = require("lodash");const MockDate = require("mockdate");+const rewiremock = require("rewiremock/node");const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};+rewiremock("../../static/js/message_store").with(message_store);const page_params = set_global("page_params", {});+rewiremock.enable();+const people = zrequire("people");const settings_config = zrequire("settings_config");const visibility = settings_config.email_address_visibility_values;@@ -1113,3 +1117,4 @@ run_test("get_active_message_people", () => {// reset to native Date()MockDate.reset();+rewiremock.disable();diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.jsindex 98565428a8c..b2235e42f5a 100644--- a/frontend_tests/node_tests/reactions.js+++ b/frontend_tests/node_tests/reactions.js@@ -54,12 +54,16 @@ const message = {],};-const message_store = set_global("message_store", {+const message_store = {+ __esModule: true,+get(message_id) {assert.equal(message_id, 1001);return message;},-});+};++rewiremock("../../static/js/message_store").with(message_store);set_global("current_msg_list", {selected_message() {diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.jsindex c1e55b7feca..64a5e3cc5e9 100644--- a/frontend_tests/node_tests/recent_senders.js+++ b/frontend_tests/node_tests/recent_senders.js@@ -2,13 +2,15 @@const {strict: assert} = require("assert");+const rewiremock = require("rewiremock/node");+const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");let next_id = 0;const messages = [];-set_global("message_store", {+rewiremock("../../static/js/message_store").with({get: (msg_id) => messages[msg_id - 1],});set_global("message_list", {@@ -19,6 +21,8 @@ set_global("message_list", {},});+rewiremock.enable();+const rs = zrequire("recent_senders");zrequire("message_util.js");@@ -228,3 +232,4 @@ run_test("process_message_for_senders", () => {// no changes should take place in this case.rs.update_topics_of_deleted_message_ids([-1]);});+rewiremock.disable();diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.jsindex b585e123841..6c84f824795 100644--- a/frontend_tests/node_tests/recent_topics.js+++ b/frontend_tests/node_tests/recent_topics.js@@ -146,7 +146,7 @@ set_global("message_list", {},},});-set_global("message_store", {+rewiremock("../../static/js/message_store").with({get: (msg_id) => messages[msg_id - 1],});rewiremock("../../static/js/stream_data").with({diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.jsindex 2358eff23c1..0b23ecf79c0 100644--- a/frontend_tests/node_tests/search_suggestion.js+++ b/frontend_tests/node_tests/search_suggestion.js@@ -2,6 +2,8 @@const {strict: assert} = require("assert");+const rewiremock = require("rewiremock/node");+const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");@@ -9,12 +11,14 @@ const page_params = set_global("page_params", {search_pills_enabled: true,});-set_global("message_store", {+rewiremock("../../static/js/message_store").with({user_ids: () => [],});set_global("narrow", {});+rewiremock.enable();+const settings_config = zrequire("settings_config");page_params.realm_email_address_visibility =settings_config.email_address_visibility_values.admins_only.code;@@ -966,3 +970,4 @@ run_test("multiple_operators_without_pills", () => {expected = ["is:alerted sender:[email protected] abc"];assert.deepEqual(suggestions.strings, expected);});+rewiremock.disable();diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.jsindex bbe33d0d29f..2d78872791b 100644--- a/frontend_tests/node_tests/search_suggestion_legacy.js+++ b/frontend_tests/node_tests/search_suggestion_legacy.js@@ -2,17 +2,21 @@const {strict: assert} = require("assert");+const rewiremock = require("rewiremock/node");+const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");const page_params = set_global("page_params", {search_pills_enabled: false,});-set_global("message_store", {+rewiremock("../../static/js/message_store").with({user_ids: () => [],});set_global("narrow", {});+rewiremock.enable();+const settings_config = zrequire("settings_config");page_params.realm_email_address_visibility =settings_config.email_address_visibility_values.admins_only.code;@@ -884,3 +888,4 @@ run_test("queries_with_spaces", () => {expected = ["stream:offi", "stream:office"];assert.deepEqual(suggestions.strings, expected);});+rewiremock.disable();diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.jsindex a184484120f..7ade075c38e 100644--- a/frontend_tests/node_tests/server_events.js+++ b/frontend_tests/node_tests/server_events.js@@ -53,7 +53,6 @@ set_global("$", {rewiremock.enable();-zrequire("message_store");const server_events = zrequire("server_events");set_global("$", $);diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.jsindex 455eda92d35..8ed67503e33 100644--- a/frontend_tests/node_tests/submessage.js+++ b/frontend_tests/node_tests/submessage.js@@ -10,7 +10,9 @@ const {run_test} = require("../zjsunit/test");const channel = {__esModule: true};rewiremock("../../static/js/channel").with(channel);const widgetize = set_global("widgetize", {});-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};++rewiremock("../../static/js/message_store").with(message_store);rewiremock.enable();diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.jsindex e0f4cce232c..a3461be7c63 100644--- a/frontend_tests/node_tests/unread.js+++ b/frontend_tests/node_tests/unread.js@@ -15,7 +15,9 @@ let page_params = set_global("page_params", {rewiremock("../../static/js/narrow_state").with({});set_global("current_msg_list", {});set_global("home_msg_list", {});-const message_store = set_global("message_store", {});+const message_store = {__esModule: true};++rewiremock("../../static/js/message_store").with(message_store);rewiremock.enable();diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 1af2f507b39..b301877f184 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -30,7 +30,6 @@ import "../ui";import "../composebox_typeahead";import "../hotkey";import "../notifications";-import "../message_store";import "../message_util";import "../message_events";import "../message_fetch";diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 48e4ebc1600..7f2e90d07ec 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -14,6 +14,7 @@ import * as hashchange from "./hashchange";import * as message_edit from "./message_edit";import * as message_edit_history from "./message_edit_history";import * as message_flags from "./message_flags";+import * as message_store from "./message_store";import * as muting_ui from "./muting_ui";import * as notifications from "./notifications";import * as overlays from "./overlays";diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.jsindex e14be873675..ab064b8ef59 100644--- a/static/js/composebox_typeahead.js+++ b/static/js/composebox_typeahead.js@@ -13,6 +13,7 @@ const channel = require("./channel");const compose = require("./compose");const compose_pm_pill = require("./compose_pm_pill");const compose_state = require("./compose_state");+const message_store = require("./message_store");const people = require("./people");const rows = require("./rows");const settings_data = require("./settings_data");diff --git a/static/js/echo.js b/static/js/echo.jsindex cc7c9067d1d..4f3a410ce2f 100644--- a/static/js/echo.js+++ b/static/js/echo.js@@ -2,6 +2,7 @@ import * as alert_words from "./alert_words";import * as compose from "./compose";import * as local_message from "./local_message";import * as markdown from "./markdown";+import * as message_store from "./message_store";import * as narrow_state from "./narrow_state";import * as notifications from "./notifications";import * as people from "./people";diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.jsindex de4e7edd281..26fc0b56d37 100644--- a/static/js/emoji_picker.js+++ b/static/js/emoji_picker.js@@ -8,6 +8,7 @@ const render_emoji_popover_content = require("../templates/emoji_popover_contentconst render_emoji_popover_search_results = require("../templates/emoji_popover_search_results.hbs");const render_emoji_showcase = require("../templates/emoji_showcase.hbs");+const message_store = require("./message_store");const popovers = require("./popovers");const rows = require("./rows");diff --git a/static/js/filter.js b/static/js/filter.jsindex 48c97f8cbca..ac333db60cf 100644--- a/static/js/filter.js+++ b/static/js/filter.js@@ -1,6 +1,7 @@import Handlebars from "handlebars/runtime";import _ from "lodash";+import * as message_store from "./message_store";import * as people from "./people";import * as stream_data from "./stream_data";import * as util from "./util";diff --git a/static/js/floating_recipient_bar.js b/static/js/floating_recipient_bar.jsindex 343812ea593..2302b3926f6 100644--- a/static/js/floating_recipient_bar.js+++ b/static/js/floating_recipient_bar.js@@ -1,3 +1,4 @@+import * as message_store from "./message_store";import * as rows from "./rows";let is_floating_recipient_bar_showing = false;diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex aa89a55aafb..9c467a990be 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -27,7 +27,6 @@ declare let input_pill: any;declare let message_events: any;declare let message_fetch: any;declare let message_list: any;-declare let message_store: any;declare let message_util: any;declare let narrow: any;declare let padded_widget: any;diff --git a/static/js/lightbox.js b/static/js/lightbox.jsindex 3de6ba1beb7..ba236545805 100644--- a/static/js/lightbox.js+++ b/static/js/lightbox.js@@ -1,4 +1,5 @@import {LightboxCanvas} from "./lightbox_canvas";+import * as message_store from "./message_store";import * as overlays from "./overlays";import * as people from "./people";import * as popovers from "./popovers";diff --git a/static/js/markdown.js b/static/js/markdown.jsindex 22b45fecedf..7f697e924dd 100644--- a/static/js/markdown.js+++ b/static/js/markdown.js@@ -6,6 +6,8 @@ import * as emoji from "../shared/js/emoji";import * as fenced_code from "../shared/js/fenced_code";import marked from "../third/marked/lib/marked";+import * as message_store from "./message_store";+// This contains zulip's frontend Markdown implementation; see// docs/subsystems/markdown.md for docs on our Markdown syntax. The other// main piece in rendering Markdown client-side isdiff --git a/static/js/message_edit.js b/static/js/message_edit.jsindex 5587b15d180..2d2b1f4285e 100644--- a/static/js/message_edit.js+++ b/static/js/message_edit.js@@ -9,6 +9,7 @@ import * as condense from "./condense";import * as echo from "./echo";import * as loading from "./loading";import * as markdown from "./markdown";+import * as message_store from "./message_store";import * as message_viewport from "./message_viewport";import * as resize from "./resize";import * as rows from "./rows";diff --git a/static/js/message_events.js b/static/js/message_events.jsindex 2cbadd4df2b..2713a5998f4 100644--- a/static/js/message_events.js+++ b/static/js/message_events.js@@ -8,6 +8,7 @@ const condense = require("./condense");const huddle_data = require("./huddle_data");const message_edit = require("./message_edit");const message_edit_history = require("./message_edit_history");+const message_store = require("./message_store");const narrow_state = require("./narrow_state");const notifications = require("./notifications");const pm_list = require("./pm_list");diff --git a/static/js/message_fetch.js b/static/js/message_fetch.jsindex a176901c32d..a80cb2a4b55 100644--- a/static/js/message_fetch.js+++ b/static/js/message_fetch.js@@ -4,6 +4,7 @@ const channel = require("./channel");const {Filter} = require("./filter");const huddle_data = require("./huddle_data");const message_scroll = require("./message_scroll");+const message_store = require("./message_store");const people = require("./people");const pm_list = require("./pm_list");const stream_data = require("./stream_data");diff --git a/static/js/message_flags.js b/static/js/message_flags.jsindex 464b53ced4d..647bb76d4fb 100644--- a/static/js/message_flags.js+++ b/static/js/message_flags.js@@ -1,6 +1,7 @@import _ from "lodash";import * as channel from "./channel";+import * as message_store from "./message_store";import * as starred_messages from "./starred_messages";function send_flag_update(message, flag, op) {diff --git a/static/js/message_list_view.js b/static/js/message_list_view.jsindex c61e9fb15b4..ace2bf9a2b4 100644--- a/static/js/message_list_view.js+++ b/static/js/message_list_view.js@@ -11,6 +11,7 @@ import * as compose_fade from "./compose_fade";import * as condense from "./condense";import * as hash_util from "./hash_util";import * as message_edit from "./message_edit";+import * as message_store from "./message_store";import * as message_viewport from "./message_viewport";import * as narrow_state from "./narrow_state";import * as people from "./people";diff --git a/static/js/message_live_update.js b/static/js/message_live_update.jsindex f471369a75b..1d089bbd7bf 100644--- a/static/js/message_live_update.js+++ b/static/js/message_live_update.js@@ -1,3 +1,4 @@+import * as message_store from "./message_store";import * as people from "./people";function rerender_messages_view() {diff --git a/static/js/message_store.js b/static/js/message_store.jsindex c1fc0e03993..ffc2abede26 100644--- a/static/js/message_store.js+++ b/static/js/message_store.js@@ -1,11 +1,9 @@-"use strict";--const alert_words = require("./alert_words");-const people = require("./people");-const pm_conversations = require("./pm_conversations");-const recent_senders = require("./recent_senders");-const stream_topic_history = require("./stream_topic_history");-const util = require("./util");+import * as alert_words from "./alert_words";+import * as people from "./people";+import * as pm_conversations from "./pm_conversations";+import * as recent_senders from "./recent_senders";+import * as stream_topic_history from "./stream_topic_history";+import * as util from "./util";const stored_messages = new Map();@@ -24,11 +22,11 @@ const stored_messages = new Map();*/const message_user_ids = new Set();-exports.user_ids = function () {+export function user_ids() {return Array.from(message_user_ids);-};+}-exports.get = function get(message_id) {+export function get(message_id) {if (message_id === undefined || message_id === null) {blueslip.error("message_store.get got bad value: " + message_id);return undefined;@@ -43,15 +41,15 @@ exports.get = function get(message_id) {}return stored_messages.get(message_id);-};+}-exports.each = function (f) {+export function each(f) {for (const [id, message] of stored_messages) {f(message, id);}-};+}-exports.get_pm_emails = function (message) {+export function get_pm_emails(message) {const user_ids = people.pm_with_user_ids(message);const emails = user_ids.map((user_id) => {@@ -65,9 +63,9 @@ exports.get_pm_emails = function (message) {.sort();return emails.join(", ");-};+}-exports.get_pm_full_names = function (message) {+export function get_pm_full_names(message) {const user_ids = people.pm_with_user_ids(message);const names = user_ids.map((user_id) => {@@ -81,9 +79,9 @@ exports.get_pm_full_names = function (message) {.sort();return names.join(", ");-};+}-exports.process_message_for_recent_private_messages = function (message) {+export function process_message_for_recent_private_messages(message) {const user_ids = people.pm_with_user_ids(message);if (!user_ids) {return;@@ -94,9 +92,9 @@ exports.process_message_for_recent_private_messages = function (message) {}pm_conversations.recent.insert(user_ids, message.id);-};+}-exports.set_message_booleans = function (message) {+export function set_message_booleans(message) {const flags = message.flags || [];function convert_flag(flag_name) {@@ -115,9 +113,9 @@ exports.set_message_booleans = function (message) {// just a distraction, so we delete it. (All the downstream code// uses booleans.)delete message.flags;-};+}-exports.init_booleans = function (message) {+export function init_booleans(message) {// This initializes booleans for the local-echo path where// we don't have flags from the server yet. (We want to// explicitly set flags to false to be consistent with other@@ -129,9 +127,9 @@ exports.init_booleans = function (message) {message.mentioned_me_directly = false;message.collapsed = false;message.alerted = false;-};+}-exports.update_booleans = function (message, flags) {+export function update_booleans(message, flags) {// When we get server flags for local echo or message edits,// we are vulnerable to race conditions, so only update flags// that are driven by message content.@@ -142,9 +140,9 @@ exports.update_booleans = function (message, flags) {message.mentioned = convert_flag("mentioned") || convert_flag("wildcard_mentioned");message.mentioned_me_directly = convert_flag("mentioned");message.alerted = convert_flag("has_alert_word");-};+}-exports.add_message_metadata = function (message) {+export function add_message_metadata(message) {const cached_msg = stored_messages.get(message.id);if (cached_msg !== undefined) {// Copy the match topic and content over if they exist on@@ -188,12 +186,12 @@ exports.add_message_metadata = function (message) {case "private":message.is_private = true;- message.reply_to = util.normalize_recipients(exports.get_pm_emails(message));- message.display_reply_to = exports.get_pm_full_names(message);+ message.reply_to = util.normalize_recipients(get_pm_emails(message));+ message.display_reply_to = get_pm_full_names(message);message.pm_with_url = people.pm_with_url(message);message.to_user_ids = people.pm_reply_user_string(message);- exports.process_message_for_recent_private_messages(message);+ process_message_for_recent_private_messages(message);if (people.is_my_user_id(message.sender_id)) {for (const recip of message.display_recipient) {@@ -209,20 +207,20 @@ exports.add_message_metadata = function (message) {}stored_messages.set(message.id, message);return message;-};+}-exports.update_property = function (property, value, info) {+export function update_property(property, value, info) {switch (property) {case "sender_full_name":case "small_avatar_url":- exports.each((msg) => {+ each((msg) => {if (msg.sender_id && msg.sender_id === info.user_id) {msg[property] = value;}});break;case "stream_name":- exports.each((msg) => {+ each((msg) => {if (msg.stream_id && msg.stream_id === info.stream_id) {msg.display_recipient = value;msg.stream = value;@@ -230,9 +228,9 @@ exports.update_property = function (property, value, info) {});break;}-};+}-exports.reify_message_id = function (opts) {+export function reify_message_id(opts) {const old_id = opts.old_id;const new_id = opts.new_id;if (stored_messages.has(old_id)) {@@ -249,6 +247,4 @@ exports.reify_message_id = function (opts) {}}}-};--window.message_store = exports;+}diff --git a/static/js/message_util.js b/static/js/message_util.jsindex 267831386d1..1556d605116 100644--- a/static/js/message_util.js+++ b/static/js/message_util.js@@ -1,6 +1,7 @@"use strict";const loading = require("./loading");+const message_store = require("./message_store");const resize = require("./resize");const unread_ui = require("./unread_ui");diff --git a/static/js/narrow.js b/static/js/narrow.jsindex 8e07e44010c..6afaa14e89a 100644--- a/static/js/narrow.js+++ b/static/js/narrow.js@@ -10,6 +10,7 @@ const hashchange = require("./hashchange");const message_edit = require("./message_edit");const {MessageListData} = require("./message_list_data");const message_scroll = require("./message_scroll");+const message_store = require("./message_store");const narrow_state = require("./narrow_state");const notifications = require("./notifications");const people = require("./people");diff --git a/static/js/notifications.js b/static/js/notifications.jsindex 2d319eb16eb..575c7963346 100644--- a/static/js/notifications.js+++ b/static/js/notifications.js@@ -6,6 +6,7 @@ import render_notification from "../templates/notification.hbs";import * as alert_words from "./alert_words";import * as channel from "./channel";import * as favicon from "./favicon";+import * as message_store from "./message_store";import * as muting from "./muting";import * as narrow_state from "./narrow_state";import * as navigate from "./navigate";diff --git a/static/js/people.js b/static/js/people.jsindex 31e4f9d2ff8..edb5bd95569 100644--- a/static/js/people.js+++ b/static/js/people.js@@ -5,6 +5,7 @@ import _ from "lodash";import * as typeahead from "../shared/js/typeahead";import {FoldDict} from "./fold_dict";+import * as message_store from "./message_store";import * as reload_state from "./reload_state";import * as settings_data from "./settings_data";import * as util from "./util";diff --git a/static/js/reactions.js b/static/js/reactions.jsindex ddfa36ec6dd..877ad3c0adc 100644--- a/static/js/reactions.js+++ b/static/js/reactions.js@@ -6,6 +6,7 @@ const emoji = require("../shared/js/emoji");const render_message_reaction = require("../templates/message_reaction.hbs");const channel = require("./channel");+const message_store = require("./message_store");const people = require("./people");exports.view = {}; // function namespacediff --git a/static/js/recent_topics.js b/static/js/recent_topics.jsindex bcdaf3823b3..a923128ece8 100644--- a/static/js/recent_topics.js+++ b/static/js/recent_topics.js@@ -8,6 +8,7 @@ const drafts = require("./drafts");const hash_util = require("./hash_util");const ListWidget = require("./list_widget");const {localstorage} = require("./localstorage");+const message_store = require("./message_store");const muting = require("./muting");const narrow_state = require("./narrow_state");const navigate = require("./navigate");diff --git a/static/js/rows.js b/static/js/rows.jsindex f83697294b0..fbecfa7e6b8 100644--- a/static/js/rows.js+++ b/static/js/rows.js@@ -1,3 +1,4 @@+import * as message_store from "./message_store";// We don't need an andSelf() here because we already know// that our next element is *not* a message_row, so this// isn't going to end up empty unless we're at the bottom or top.diff --git a/static/js/server_events.js b/static/js/server_events.jsindex 096724686c4..45b3a9eb897 100644--- a/static/js/server_events.js+++ b/static/js/server_events.js@@ -4,6 +4,7 @@ const _ = require("lodash");const channel = require("./channel");const echo = require("./echo");+const message_store = require("./message_store");const reload = require("./reload");const reload_state = require("./reload_state");const sent_messages = require("./sent_messages");diff --git a/static/js/submessage.js b/static/js/submessage.jsindex 842a8cfc2a7..980d02db787 100644--- a/static/js/submessage.js+++ b/static/js/submessage.js@@ -1,4 +1,5 @@import * as channel from "./channel";+import * as message_store from "./message_store";export function get_message_events(message) {if (message.locally_echoed) {diff --git a/static/js/unread.js b/static/js/unread.jsindex 368f1789a7b..99bd9311f67 100644--- a/static/js/unread.js+++ b/static/js/unread.js@@ -1,6 +1,7 @@"use strict";const {FoldDict} = require("./fold_dict");+const message_store = require("./message_store");const muting = require("./muting");const people = require("./people");const stream_data = require("./stream_data");diff --git a/static/js/unread_ops.js b/static/js/unread_ops.jsindex 5fdcbc2dcc4..03a222e5116 100644--- a/static/js/unread_ops.js+++ b/static/js/unread_ops.js@@ -2,6 +2,7 @@const channel = require("./channel");const message_flags = require("./message_flags");+const message_store = require("./message_store");const message_viewport = require("./message_viewport");const notifications = require("./notifications");const overlays = require("./overlays");