From c94ffb5319173061432d6d910425dfeb9708ea62 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 27 Feb 2021 16:07:13 -0800 Subject: [PATCH] js: Convert static/js/hash_util.js to ES6 module. Signed-off-by: Anders Kaseorg --- .eslintrc.json | 1 - frontend_tests/node_tests/activity.js | 1 - frontend_tests/node_tests/compose_actions.js | 4 +- frontend_tests/node_tests/markdown.js | 1 - frontend_tests/node_tests/markdown_katex.js | 1 - frontend_tests/node_tests/peer_data.js | 1 - frontend_tests/node_tests/pm_list.js | 1 - frontend_tests/node_tests/popovers.js | 1 - frontend_tests/node_tests/recent_topics.js | 2 +- frontend_tests/node_tests/stream_data.js | 1 - frontend_tests/node_tests/stream_edit.js | 2 +- frontend_tests/node_tests/stream_list.js | 1 - frontend_tests/node_tests/subs.js | 7 +- frontend_tests/node_tests/topic_list_data.js | 1 - frontend_tests/node_tests/typeahead_helper.js | 1 - frontend_tests/node_tests/ui_init.js | 1 - static/js/buddy_data.js | 1 + static/js/bundles/app.js | 1 - static/js/click_handlers.js | 1 + static/js/compose_actions.js | 1 + static/js/global.d.ts | 1 - static/js/hash_util.js | 123 ++++++++---------- static/js/hashchange.js | 1 + static/js/markdown_config.js | 1 + static/js/message_list_view.js | 1 + static/js/message_scroll.js | 1 + static/js/pm_list.js | 1 + static/js/popovers.js | 1 + static/js/recent_topics.js | 1 + static/js/reminder.js | 1 + static/js/stream_data.js | 1 + static/js/stream_edit.js | 1 + static/js/stream_list.js | 1 + static/js/stream_popover.js | 1 + static/js/subs.js | 1 + static/js/topic_list_data.js | 1 + 36 files changed, 84 insertions(+), 85 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e5a5afd96d..37f2002ba3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -144,7 +144,6 @@ "emoji_picker": false, "favicon": false, "flatpickr": false, - "hash_util": false, "hashchange": false, "helpers": false, "history": false, diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index 58573a6496..099b65b60b 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -91,7 +91,6 @@ rewiremock.enable(); const huddle_data = zrequire("huddle_data"); const compose_fade = zrequire("compose_fade"); zrequire("unread"); -zrequire("hash_util"); const narrow = zrequire("narrow"); const presence = zrequire("presence"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index 6971c24e68..64e359b29c 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -21,7 +21,9 @@ const compose_pm_pill = {__esModule: true}; rewiremock("../../static/js/compose_pm_pill").with(compose_pm_pill); -const hash_util = set_global("hash_util", {}); +const hash_util = {__esModule: true}; + +rewiremock("../../static/js/hash_util").with(hash_util); rewiremock("../../static/js/reload_state").with({ is_in_progress: () => false, diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 166a44d7a2..3e0d13d9a3 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -32,7 +32,6 @@ set_global("Image", Image); const doc = ""; set_global("document", doc); -zrequire("hash_util"); const emoji = zrequire("emoji", "shared/js/emoji"); const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json"); const pygments_data = zrequire("pygments_data", "generated/pygments_data.json"); diff --git a/frontend_tests/node_tests/markdown_katex.js b/frontend_tests/node_tests/markdown_katex.js index 85443d2a30..b2df1eb0ef 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("hash_util"); zrequire("message_store"); const markdown = zrequire("markdown"); diff --git a/frontend_tests/node_tests/peer_data.js b/frontend_tests/node_tests/peer_data.js index f3e7ca844f..51b00a9154 100644 --- a/frontend_tests/node_tests/peer_data.js +++ b/frontend_tests/node_tests/peer_data.js @@ -13,7 +13,6 @@ const {run_test} = require("../zjsunit/test"); const peer_data = zrequire("peer_data"); const people = zrequire("people"); -zrequire("hash_util"); const stream_data = zrequire("stream_data"); set_global("page_params", { diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js index d72c596028..379dc44e7b 100644 --- a/frontend_tests/node_tests/pm_list.js +++ b/frontend_tests/node_tests/pm_list.js @@ -32,7 +32,6 @@ rewiremock.enable(); zrequire("presence"); zrequire("buddy_data"); -zrequire("hash_util"); const people = zrequire("people"); const pm_conversations = zrequire("pm_conversations"); const pm_list = zrequire("pm_list"); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index 5e5d275c91..f6bf648546 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -46,7 +46,6 @@ rewiremock("clipboard").with(ClipboardJS); rewiremock.enable(); -zrequire("hash_util"); zrequire("narrow"); const people = zrequire("people"); zrequire("presence"); diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index 585bb59234..b585e12384 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -47,7 +47,7 @@ set_global("unread", { }, }, }); -set_global("hash_util", { +rewiremock("../../static/js/hash_util").with({ by_stream_uri: () => "https://www.example.com", by_stream_topic_uri: () => "https://www.example.com", }); diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 651da9841e..126e969ed1 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -14,7 +14,6 @@ const page_params = set_global("page_params", { }); const color_data = zrequire("color_data"); -zrequire("hash_util"); const stream_topic_history = zrequire("stream_topic_history"); const people = zrequire("people"); const stream_color = zrequire("stream_color"); diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js index 329a8bfc23..faadd8d16f 100644 --- a/frontend_tests/node_tests/stream_edit.js +++ b/frontend_tests/node_tests/stream_edit.js @@ -14,7 +14,7 @@ stub_templates(() => noop); rewiremock("../../static/js/channel").with({}); set_global("hashchange", {update_browser_history: noop}); -set_global("hash_util", { +rewiremock("../../static/js/hash_util").with({ stream_edit_uri: noop, by_stream_uri: noop, }); diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index 389f978e7f..587f0bb05e 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -32,7 +32,6 @@ rewiremock.enable(); const {Filter} = zrequire("Filter", "js/filter"); const stream_sort = zrequire("stream_sort"); const stream_color = zrequire("stream_color"); -zrequire("hash_util"); const unread = zrequire("unread"); const stream_data = zrequire("stream_data"); const scroll_util = zrequire("scroll_util"); diff --git a/frontend_tests/node_tests/subs.js b/frontend_tests/node_tests/subs.js index cd05c21fbf..10c61284f7 100644 --- a/frontend_tests/node_tests/subs.js +++ b/frontend_tests/node_tests/subs.js @@ -2,6 +2,8 @@ const {strict: assert} = require("assert"); +const rewiremock = require("rewiremock/node"); + const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); @@ -19,10 +21,12 @@ set_global("location", { hash: `#streams/${denmark_stream_id}/announce`, }); -set_global("hash_util", { +rewiremock("../../static/js/hash_util").with({ by_stream_uri: () => {}, }); +rewiremock.enable(); + const stream_data = zrequire("stream_data"); const subs = zrequire("subs"); @@ -205,3 +209,4 @@ run_test("redraw_left_panel", (override) => { assert(!$(".right .settings").visible()); assert($(".nothing-selected").visible()); }); +rewiremock.disable(); diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.js index 1654419cfb..d82920e94f 100644 --- a/frontend_tests/node_tests/topic_list_data.js +++ b/frontend_tests/node_tests/topic_list_data.js @@ -26,7 +26,6 @@ set_global("message_list", {}); rewiremock.enable(); -zrequire("hash_util"); const stream_data = zrequire("stream_data"); const unread = zrequire("unread"); const stream_topic_history = zrequire("stream_topic_history"); diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index 289adc951a..85019d0709 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -19,7 +19,6 @@ const peer_data = zrequire("peer_data"); const people = zrequire("people"); const stream_data = zrequire("stream_data"); zrequire("narrow"); -zrequire("hash_util"); const emoji = zrequire("emoji", "shared/js/emoji"); const pygments_data = zrequire("pygments_data", "generated/pygments_data.json"); diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js index f4d845dffb..d57034c8e8 100644 --- a/frontend_tests/node_tests/ui_init.js +++ b/frontend_tests/node_tests/ui_init.js @@ -109,7 +109,6 @@ rewiremock.enable(); const util = zrequire("util"); -zrequire("hash_util"); zrequire("message_view_header"); zrequire("presence"); zrequire("search_pill_widget"); diff --git a/static/js/buddy_data.js b/static/js/buddy_data.js index 9f3d05f58d..b013b9e831 100644 --- a/static/js/buddy_data.js +++ b/static/js/buddy_data.js @@ -1,6 +1,7 @@ "use strict"; const compose_fade = require("./compose_fade"); +const hash_util = require("./hash_util"); const people = require("./people"); const user_status = require("./user_status"); const util = require("./util"); diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index 953a7a8bde..4c0886ae3c 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 "../hash_util"; import "../hashchange"; import "../message_flags"; import "../starred_messages"; diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index f783b84b6e..201c5134c8 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -9,6 +9,7 @@ import render_buddy_list_tooltip_content from "../templates/buddy_list_tooltip_c import * as channel from "./channel"; import * as compose from "./compose"; import * as compose_state from "./compose_state"; +import * as hash_util from "./hash_util"; import * as message_edit from "./message_edit"; import * as message_edit_history from "./message_edit_history"; import * as muting_ui from "./muting_ui"; diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js index 7fd61dd40c..79fd5ed5e5 100644 --- a/static/js/compose_actions.js +++ b/static/js/compose_actions.js @@ -11,6 +11,7 @@ const compose_fade = require("./compose_fade"); const compose_pm_pill = require("./compose_pm_pill"); const compose_state = require("./compose_state"); const drafts = require("./drafts"); +const hash_util = require("./hash_util"); const message_viewport = require("./message_viewport"); const narrow_state = require("./narrow_state"); const notifications = require("./notifications"); diff --git a/static/js/global.d.ts b/static/js/global.d.ts index a7c7cc290c..7bf9177ba8 100644 --- a/static/js/global.d.ts +++ b/static/js/global.d.ts @@ -22,7 +22,6 @@ declare let emoji: any; declare let emoji_picker: any; declare let favicon: any; declare let hashchange: any; -declare let hash_util: any; declare let helpers: any; declare let home_msg_list: any; declare let hotspots: any; diff --git a/static/js/hash_util.js b/static/js/hash_util.js index 2123e44ee6..fb83d6c167 100644 --- a/static/js/hash_util.js +++ b/static/js/hash_util.js @@ -1,16 +1,14 @@ -"use strict"; +import * as narrow_state from "./narrow_state"; +import * as people from "./people"; +import * as stream_data from "./stream_data"; +import * as ui_report from "./ui_report"; -const narrow_state = require("./narrow_state"); -const people = require("./people"); -const stream_data = require("./stream_data"); -const ui_report = require("./ui_report"); - -exports.get_hash_category = function (hash) { +export function get_hash_category(hash) { // given "#streams/subscribed", returns "streams" return hash ? hash.replace(/^#/, "").split(/\//)[0] : ""; -}; +} -exports.get_hash_section = function (hash) { +export function get_hash_section(hash) { // given "#settings/your-account", returns "your-account" // given '#streams/5/social", returns "5" if (!hash) { @@ -20,16 +18,16 @@ exports.get_hash_section = function (hash) { const parts = hash.replace(/\/$/, "").split(/\//); return parts[1] || ""; -}; +} // Some browsers zealously URI-decode the contents of // window.location.hash. So we hide our URI-encoding // by replacing % with . (like MediaWiki). -exports.encodeHashComponent = function (str) { +export function encodeHashComponent(str) { return encodeURIComponent(str).replace(/\./g, "%2E").replace(/%/g, "."); -}; +} -exports.encode_operand = function (operator, operand) { +export function encode_operand(operator, operand) { if (operator === "group-pm-with" || operator === "pm-with" || operator === "sender") { const slug = people.emails_to_slug(operand); if (slug) { @@ -38,29 +36,29 @@ exports.encode_operand = function (operator, operand) { } if (operator === "stream") { - return exports.encode_stream_name(operand); + return encode_stream_name(operand); } - return exports.encodeHashComponent(operand); -}; + return encodeHashComponent(operand); +} -exports.encode_stream_id = function (stream_id) { +export function encode_stream_id(stream_id) { // stream_data appends the stream name, but it does not do the // URI encoding piece const slug = stream_data.id_to_slug(stream_id); - return exports.encodeHashComponent(slug); -}; + return encodeHashComponent(slug); +} -exports.encode_stream_name = function (operand) { +export function encode_stream_name(operand) { // stream_data prefixes the stream id, but it does not do the // URI encoding piece operand = stream_data.name_to_slug(operand); - return exports.encodeHashComponent(operand); -}; + return encodeHashComponent(operand); +} -exports.decodeHashComponent = function (str) { +export function decodeHashComponent(str) { try { // This fails for URLs containing // foo.foo or foo%foo due to our fault in special handling @@ -73,9 +71,9 @@ exports.decodeHashComponent = function (str) { ui_report.error(i18n.t("Invalid URL"), undefined, $("#home-error"), 2000); return ""; } -}; +} -exports.decode_operand = function (operator, operand) { +export function decode_operand(operator, operand) { if (operator === "group-pm-with" || operator === "pm-with" || operator === "sender") { const emails = people.slug_to_emails(operand); if (emails) { @@ -83,32 +81,27 @@ exports.decode_operand = function (operator, operand) { } } - operand = exports.decodeHashComponent(operand); + operand = decodeHashComponent(operand); if (operator === "stream") { return stream_data.slug_to_name(operand); } return operand; -}; +} -exports.by_stream_uri = function (stream_id) { - return "#narrow/stream/" + exports.encode_stream_id(stream_id); -}; +export function by_stream_uri(stream_id) { + return "#narrow/stream/" + encode_stream_id(stream_id); +} -exports.by_stream_topic_uri = function (stream_id, topic) { - return ( - "#narrow/stream/" + - exports.encode_stream_id(stream_id) + - "/topic/" + - exports.encodeHashComponent(topic) - ); -}; +export function by_stream_topic_uri(stream_id, topic) { + return "#narrow/stream/" + encode_stream_id(stream_id) + "/topic/" + encodeHashComponent(topic); +} // Encodes an operator list into the // corresponding hash: the # component // of the narrow URL -exports.operators_to_hash = function (operators) { +export function operators_to_hash(operators) { let hash = "#"; if (operators !== undefined) { @@ -123,33 +116,33 @@ exports.operators_to_hash = function (operators) { hash += "/" + sign + - exports.encodeHashComponent(operator) + + encodeHashComponent(operator) + "/" + - exports.encode_operand(operator, operand); + encode_operand(operator, operand); } } return hash; -}; +} -exports.by_sender_uri = function (reply_to) { - return exports.operators_to_hash([{operator: "sender", operand: reply_to}]); -}; +export function by_sender_uri(reply_to) { + return operators_to_hash([{operator: "sender", operand: reply_to}]); +} -exports.pm_with_uri = function (reply_to) { +export function pm_with_uri(reply_to) { const slug = people.emails_to_slug(reply_to); return "#narrow/pm-with/" + slug; -}; +} -exports.huddle_with_uri = function (user_ids_string) { +export function huddle_with_uri(user_ids_string) { // This method is convenient for callers // that have already converted emails to a comma-delimited // list of user_ids. We should be careful to keep this // consistent with hash_util.decode_operand. return "#narrow/pm-with/" + user_ids_string + "-group"; -}; +} -exports.by_conversation_and_time_uri = function (message) { +export function by_conversation_and_time_uri(message) { const absolute_url = window.location.protocol + "//" + @@ -157,36 +150,34 @@ exports.by_conversation_and_time_uri = function (message) { "/" + window.location.pathname.split("/")[1]; - const suffix = "/near/" + exports.encodeHashComponent(message.id); + const suffix = "/near/" + encodeHashComponent(message.id); if (message.type === "stream") { - return ( - absolute_url + exports.by_stream_topic_uri(message.stream_id, message.topic) + suffix - ); + return absolute_url + by_stream_topic_uri(message.stream_id, message.topic) + suffix; } return absolute_url + people.pm_perma_link(message) + suffix; -}; +} -exports.stream_edit_uri = function (sub) { - const hash = `#streams/${sub.stream_id}/${exports.encodeHashComponent(sub.name)}`; +export function stream_edit_uri(sub) { + const hash = `#streams/${sub.stream_id}/${encodeHashComponent(sub.name)}`; return hash; -}; +} -exports.search_public_streams_notice_url = function () { +export function search_public_streams_notice_url() { // Computes the URL of the current narrow if streams:public were added. const operators = narrow_state.filter().operators(); const public_operator = {operator: "streams", operand: "public"}; - return exports.operators_to_hash([public_operator].concat(operators)); -}; + return operators_to_hash([public_operator].concat(operators)); +} -exports.parse_narrow = function (hash) { +export function parse_narrow(hash) { let i; const operators = []; for (i = 1; i < hash.length; i += 2) { // We don't construct URLs with an odd number of components, // but the user might write one. - let operator = exports.decodeHashComponent(hash[i]); + let operator = decodeHashComponent(hash[i]); // Do not parse further if empty operator encountered. if (operator === "") { break; @@ -204,10 +195,8 @@ exports.parse_narrow = function (hash) { operator = operator.slice(1); } - const operand = exports.decode_operand(operator, raw_operand); + const operand = decode_operand(operator, raw_operand); operators.push({negated, operator, operand}); } return operators; -}; - -window.hash_util = exports; +} diff --git a/static/js/hashchange.js b/static/js/hashchange.js index ed24c5428d..fdab46a13b 100644 --- a/static/js/hashchange.js +++ b/static/js/hashchange.js @@ -2,6 +2,7 @@ const drafts = require("./drafts"); const floating_recipient_bar = require("./floating_recipient_bar"); +const hash_util = require("./hash_util"); const info_overlay = require("./info_overlay"); const invite = require("./invite"); const message_viewport = require("./message_viewport"); diff --git a/static/js/markdown_config.js b/static/js/markdown_config.js index 221de8ba66..371a4f39fc 100644 --- a/static/js/markdown_config.js +++ b/static/js/markdown_config.js @@ -1,3 +1,4 @@ +import * as hash_util from "./hash_util"; import * as people from "./people"; import * as stream_data from "./stream_data"; import * as user_groups from "./user_groups"; diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index 382d29351d..c61e9fb15b 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -9,6 +9,7 @@ import render_single_message from "../templates/single_message.hbs"; import * as compose from "./compose"; 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_viewport from "./message_viewport"; import * as narrow_state from "./narrow_state"; diff --git a/static/js/message_scroll.js b/static/js/message_scroll.js index d2a2c4aa8c..32ffe0a4f9 100644 --- a/static/js/message_scroll.js +++ b/static/js/message_scroll.js @@ -1,6 +1,7 @@ import _ from "lodash"; import * as floating_recipient_bar from "./floating_recipient_bar"; +import * as hash_util from "./hash_util"; import * as loading from "./loading"; import * as message_viewport from "./message_viewport"; import * as narrow_state from "./narrow_state"; diff --git a/static/js/pm_list.js b/static/js/pm_list.js index 4b9763b670..d0c0971e62 100644 --- a/static/js/pm_list.js +++ b/static/js/pm_list.js @@ -1,3 +1,4 @@ +import * as hash_util from "./hash_util"; import * as narrow_state from "./narrow_state"; import * as people from "./people"; import * as pm_conversations from "./pm_conversations"; diff --git a/static/js/popovers.js b/static/js/popovers.js index 7f645bf245..92044c0bbd 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -16,6 +16,7 @@ import render_user_profile_modal from "../templates/user_profile_modal.hbs"; import * as compose_state from "./compose_state"; import * as condense from "./condense"; import * as feature_flags from "./feature_flags"; +import * as hash_util from "./hash_util"; import * as message_edit from "./message_edit"; import * as message_edit_history from "./message_edit_history"; import * as message_viewport from "./message_viewport"; diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js index 444fcb2baf..bcdaf3823b 100644 --- a/static/js/recent_topics.js +++ b/static/js/recent_topics.js @@ -5,6 +5,7 @@ const render_recent_topics_filters = require("../templates/recent_topics_filters const render_recent_topics_body = require("../templates/recent_topics_table.hbs"); const drafts = require("./drafts"); +const hash_util = require("./hash_util"); const ListWidget = require("./list_widget"); const {localstorage} = require("./localstorage"); const muting = require("./muting"); diff --git a/static/js/reminder.js b/static/js/reminder.js index 02f93bde7d..7eea1e7734 100644 --- a/static/js/reminder.js +++ b/static/js/reminder.js @@ -2,6 +2,7 @@ const channel = require("./channel"); const compose = require("./compose"); +const hash_util = require("./hash_util"); const notifications = require("./notifications"); const people = require("./people"); const transmit = require("./transmit"); diff --git a/static/js/stream_data.js b/static/js/stream_data.js index f152dac31c..5824fe1c1d 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -1,5 +1,6 @@ import * as color_data from "./color_data"; import {FoldDict} from "./fold_dict"; +import * as hash_util from "./hash_util"; import * as peer_data from "./peer_data"; import * as people from "./people"; import * as settings_config from "./settings_config"; diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index dab9935d64..9257b22586 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -5,6 +5,7 @@ import render_subscription_settings from "../templates/subscription_settings.hbs import render_subscription_stream_privacy_modal from "../templates/subscription_stream_privacy_modal.hbs"; import * as channel from "./channel"; +import * as hash_util from "./hash_util"; import * as ListWidget from "./list_widget"; import * as narrow_state from "./narrow_state"; import * as overlays from "./overlays"; diff --git a/static/js/stream_list.js b/static/js/stream_list.js index ace7998615..975a9e0114 100644 --- a/static/js/stream_list.js +++ b/static/js/stream_list.js @@ -5,6 +5,7 @@ const _ = require("lodash"); const render_stream_privacy = require("../templates/stream_privacy.hbs"); const render_stream_sidebar_row = require("../templates/stream_sidebar_row.hbs"); +const hash_util = require("./hash_util"); const keydown_util = require("./keydown_util"); const {ListCursor} = require("./list_cursor"); const narrow_state = require("./narrow_state"); diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js index 9783f8e25b..c4592a830b 100644 --- a/static/js/stream_popover.js +++ b/static/js/stream_popover.js @@ -7,6 +7,7 @@ import render_topic_sidebar_actions from "../templates/topic_sidebar_actions.hbs import render_unstar_messages_modal from "../templates/unstar_messages_modal.hbs"; import * as channel from "./channel"; +import * as hash_util from "./hash_util"; import * as message_edit from "./message_edit"; import * as muting from "./muting"; import * as muting_ui from "./muting_ui"; diff --git a/static/js/subs.js b/static/js/subs.js index f82bd726d1..e29c546120 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 compose_state = require("./compose_state"); +const hash_util = require("./hash_util"); const loading = require("./loading"); const message_live_update = require("./message_live_update"); const overlays = require("./overlays"); diff --git a/static/js/topic_list_data.js b/static/js/topic_list_data.js index 3b7331054c..676b3c4d22 100644 --- a/static/js/topic_list_data.js +++ b/static/js/topic_list_data.js @@ -1,3 +1,4 @@ +import * as hash_util from "./hash_util"; import * as muting from "./muting"; import * as narrow_state from "./narrow_state"; import * as stream_topic_history from "./stream_topic_history";