js: Convert static/js/page_params.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-25 14:35:45 -07:00 committed by Tim Abbott
parent bb1b2048bd
commit 38ffd47b90
158 changed files with 297 additions and 270 deletions

View File

@ -116,7 +116,6 @@
"globals": {
"$": false,
"current_msg_list": false,
"page_params": false,
"zulip_test": false
}
},
@ -126,7 +125,6 @@
"csrf_token": false,
"current_msg_list": true,
"home_msg_list": false,
"page_params": false,
"StripeCheckout": false,
"zxcvbn": false
}

View File

@ -116,12 +116,12 @@ like the following toward the top of your test file:
For modules that you want to completely stub out, use a pattern like
this:
> set_global('page_params', {
> email: 'bob@zulip.com'
> const reminder = mock_esm("../../static/js/reminder", {
> is_deferred_delivery: noop,
> });
>
> // then maybe further down
> page_params.email = 'alice@zulip.com';
> reminder.is_deferred_delivery = () => true;
One can similarly stub out functions in a module's exported interface
with either `noop` functions or actual code.

View File

@ -6,6 +6,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
const window_stub = $.create("window-stub");
@ -14,10 +15,8 @@ $(window).idle = () => {};
let filter_key_handlers;
const page_params = set_global("page_params", {
realm_users: [],
user_id: 999,
});
page_params.realm_users = [];
page_params.user_id = 999;
const _document = {
hasFocus() {

View File

@ -9,6 +9,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const jQueryFactory = require("../zjsunit/real_jquery");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true});
@ -16,7 +17,6 @@ const jquery = jQueryFactory(dom.window);
mock_cjs("jquery", $);
const page_params = set_global("page_params", {});
const history = set_global("history", {});
const loading = mock_esm("../../static/js/loading");
set_global("document", {

View File

@ -4,11 +4,10 @@ const {strict: assert} = require("assert");
const _ = require("lodash");
const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const page_params = set_global("page_params", {});
const {page_params} = require("../zjsunit/zpage_params");
const timerender = mock_esm("../../static/js/timerender");

View File

@ -11,6 +11,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
@ -49,7 +50,6 @@ const channel = mock_esm("../../static/js/channel");
const loading = mock_esm("../../static/js/loading");
const local_message = mock_esm("../../static/js/local_message");
const markdown = mock_esm("../../static/js/markdown");
const page_params = set_global("page_params", {});
const reminder = mock_esm("../../static/js/reminder", {
is_deferred_delivery: noop,
});

View File

@ -10,8 +10,6 @@ mock_cjs("jquery", $);
const noop = () => {};
set_global("page_params", {});
set_global("document", {
location: {}, // we need this to load compose.js
to_$: () => $("document-stub"),

View File

@ -5,12 +5,12 @@ const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const events = require("./lib/events");
mock_cjs("jquery", $);
const channel = mock_esm("../../static/js/channel");
const page_params = set_global("page_params", {});
const upload = mock_esm("../../static/js/upload");
mock_esm("../../static/js/resize", {
watch_manual_resize() {},

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -18,8 +19,6 @@ const message_store = mock_esm("../../static/js/message_store", {
});
const stream_topic_history = mock_esm("../../static/js/stream_topic_history");
const page_params = set_global("page_params", {});
let autosize_called;
mock_esm("../../static/js/compose_ui", {

View File

@ -7,6 +7,7 @@ const {JSDOM} = require("jsdom");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const jquery = require("../zjsunit/real_jquery");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const {window} = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
@ -14,9 +15,7 @@ const {DOMParser, document} = window;
const $ = jquery(window);
const compose_ui = mock_esm("../../static/js/compose_ui");
set_global("page_params", {
development_environment: true,
});
page_params.development_environment = true;
set_global("DOMParser", DOMParser);
set_global("document", document);

View File

@ -7,6 +7,7 @@ const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -69,11 +70,9 @@ set_global("home_msg_list", {});
// page_params is highly coupled to dispatching now
const page_params = set_global("page_params", {
test_suite: false,
is_admin: true,
realm_description: "already set description",
});
page_params.test_suite = false;
page_params.is_admin = true;
page_params.realm_description = "already set description";
// For data-oriented modules, just use them, don't stub them.
const alert_words = zrequire("alert_words");

View File

@ -6,6 +6,7 @@ const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
const events = require("./lib/events");
@ -15,7 +16,6 @@ const test_user = events.test_user;
const compose_fade = mock_esm("../../static/js/compose_fade");
const narrow_state = mock_esm("../../static/js/narrow_state");
const overlays = mock_esm("../../static/js/overlays");
const page_params = set_global("page_params", {});
const settings_org = mock_esm("../../static/js/settings_org");
const settings_streams = mock_esm("../../static/js/settings_streams");
const stream_events = mock_esm("../../static/js/stream_events");

View File

@ -6,6 +6,7 @@ const {stub_templates} = require("../zjsunit/handlebars");
const {mock_cjs, mock_esm, set_global, zrequire, with_overrides} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const ls_container = new Map();
const noop = () => {};
@ -34,9 +35,7 @@ mock_esm("../../static/js/stream_data", {
return "#FFFFFF";
},
});
set_global("page_params", {
twenty_four_hour_time: false,
});
page_params.twenty_four_hour_time = false;
const {localstorage} = zrequire("localstorage");
const drafts = zrequire("drafts");

View File

@ -6,10 +6,10 @@ const MockDate = require("mockdate");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const local_message = mock_esm("../../static/js/local_message");
const markdown = mock_esm("../../static/js/markdown");
const page_params = set_global("page_params", {});
let disparities = [];
let messages_to_rerender = [];

View File

@ -2,8 +2,9 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
// In the Zulip app you can narrow your message stream by topic, by
// sender, by PM recipient, by search keywords, etc. We will discuss
@ -13,16 +14,12 @@ const {run_test} = require("../zjsunit/test");
const {Filter} = zrequire("../js/filter");
const stream_data = zrequire("stream_data");
// This is the first time we have to deal with page_params. We
// use set_global to set it to our preferred state.
// (There are a few global variables in the Zulip codebase, and
// This is the first time we have to deal with page_params.
// page_params has a lot of important data shared by various
// modules. Most of the data is irrelevant to out tests.)
set_global("page_params", {
// Use this to explicitly say we are not a special Zephyr
// realm, since we want to test the "normal" codepath.
realm_is_zephyr_mirror_realm: false,
});
// modules. Most of the data is irrelevant to out tests.
// Use this to explicitly say we are not a special Zephyr
// realm, since we want to test the "normal" codepath.
page_params.realm_is_zephyr_mirror_realm = false;
const denmark_stream = {
color: "blue",

View File

@ -2,13 +2,13 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
const message_store = mock_esm("../../static/js/message_store");
const page_params = set_global("page_params", {});
const stream_data = zrequire("stream_data");
const people = zrequire("people");

View File

@ -13,6 +13,7 @@ const {
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
// Important note on these tests:
@ -36,8 +37,6 @@ set_global("navigator", {
platform: "",
});
const page_params = set_global("page_params", {});
// jQuery stuff should go away if we make an initialize() method.
set_global("document", "document-stub");

View File

@ -2,18 +2,17 @@
const {strict: assert} = require("assert");
const {set_global, unmock_module, zrequire} = require("../zjsunit/namespace");
const {unmock_module, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
// We download our translations in `page_params` (which
// are for the user's chosen language), so we simulate
// that here for the tests.
set_global("page_params", {
translation_data: {
"Quote and reply or forward": "French translation",
"Notification triggers": "Some French text",
},
});
page_params.translation_data = {
"Quote and reply or forward": "French translation",
"Notification triggers": "Some French text",
};
// All of our other tests stub out i18n activity;
// here we do a quick sanity check on the engine itself.

View File

@ -7,23 +7,22 @@ const markdown_assert = require("../zjsunit/markdown_assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
set_global("location", {
origin: "http://zulip.zulipdev.com",
});
const page_params = set_global("page_params", {
realm_users: [],
realm_filters: [
["#(?P<id>[0-9]{2,8})", "https://trac.example.com/ticket/%(id)s"],
["ZBUG_(?P<id>[0-9]{2,8})", "https://trac2.zulip.net/ticket/%(id)s"],
[
"ZGROUP_(?P<id>[0-9]{2,8}):(?P<zone>[0-9]{1,8})",
"https://zone_%(zone)s.zulip.net/ticket/%(id)s",
],
page_params.realm_users = [];
page_params.realm_filters = [
["#(?P<id>[0-9]{2,8})", "https://trac.example.com/ticket/%(id)s"],
["ZBUG_(?P<id>[0-9]{2,8})", "https://trac2.zulip.net/ticket/%(id)s"],
[
"ZGROUP_(?P<id>[0-9]{2,8}):(?P<zone>[0-9]{1,8})",
"https://zone_%(zone)s.zulip.net/ticket/%(id)s",
],
translate_emoticons: false,
});
];
page_params.translate_emoticons = false;
function Image() {
return {};

View File

@ -7,12 +7,10 @@
There may be a better way.
*/
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
set_global("page_params", {});
const markdown_config = zrequire("markdown_config");
const markdown = zrequire("markdown");

View File

@ -2,12 +2,11 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
let page_params = set_global("page_params", {
realm_community_topic_editing_limit_seconds: 259200,
});
page_params.realm_community_topic_editing_limit_seconds = 259200;
const message_edit = zrequire("message_edit");
@ -51,22 +50,15 @@ run_test("get_editability", () => {
sent_by_me: true,
};
page_params = set_global("page_params", {
realm_allow_message_editing: false,
});
page_params.realm_allow_message_editing = false;
assert.equal(get_editability(message), editability_types.NO);
page_params = set_global("page_params", {
realm_allow_message_editing: true,
// Limit of 0 means no time limit on editing messages
realm_message_content_edit_limit_seconds: 0,
});
page_params.realm_allow_message_editing = true;
// Limit of 0 means no time limit on editing messages
page_params.realm_message_content_edit_limit_seconds = 0;
assert.equal(get_editability(message), editability_types.FULL);
page_params = set_global("page_params", {
realm_allow_message_editing: true,
realm_message_content_edit_limit_seconds: 10,
});
page_params.realm_message_content_edit_limit_seconds = 10;
const now = new Date();
const current_timestamp = now / 1000;
message.timestamp = current_timestamp - 60;
@ -85,13 +77,11 @@ run_test("get_editability", () => {
sent_by_me: false,
type: "stream",
};
page_params = set_global("page_params", {
realm_allow_community_topic_editing: true,
realm_allow_message_editing: true,
realm_message_content_edit_limit_seconds: 0,
realm_community_topic_editing_limit_seconds: 259200,
is_admin: false,
});
page_params.realm_allow_community_topic_editing = true;
page_params.realm_allow_message_editing = true;
page_params.realm_message_content_edit_limit_seconds = 0;
page_params.realm_community_topic_editing_limit_seconds = 259200;
page_params.is_admin = false;
message.timestamp = current_timestamp - 60;
assert.equal(get_editability(message), editability_types.TOPIC_ONLY);
@ -116,11 +106,9 @@ run_test("get_editability", () => {
});
run_test("get_deletability", () => {
page_params = set_global("page_params", {
is_admin: true,
realm_allow_message_deleting: false,
realm_message_content_delete_limit_seconds: 0,
});
page_params.is_admin = true;
page_params.realm_allow_message_deleting = false;
page_params.realm_message_content_delete_limit_seconds = 0;
const message = {
sent_by_me: false,
locally_echoed: true,

View File

@ -5,13 +5,13 @@ const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
const condense = mock_esm("../../static/js/condense");
const message_edit = mock_esm("../../static/js/message_edit");
const message_list = mock_esm("../../static/js/message_list");
const notifications = mock_esm("../../static/js/notifications");
const page_params = set_global("page_params", {});
const pm_list = mock_esm("../../static/js/pm_list");
const stream_list = mock_esm("../../static/js/stream_list");
const unread_ui = mock_esm("../../static/js/unread_ui");

View File

@ -24,8 +24,6 @@ mock_esm("../../static/js/message_list_view", {
mock_esm("../../static/js/recent_topics", {
process_messages: noop,
});
// Still required for page_params.initial_pointer
set_global("page_params", {});
mock_esm("../../static/js/ui_report", {
hide_error: noop,
});

View File

@ -7,6 +7,7 @@ const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
// These unit tests for static/js/message_list.js emphasize the model-ish
// aspects of the MessageList class. We have to stub out a few functions
@ -235,7 +236,7 @@ run_test("last_sent_by_me", () => {
];
list.append(items);
set_global("page_params", {user_id: 3});
page_params.user_id = 3;
// Look for the last message where user_id == 3 (our ID)
assert.equal(list.get_last_message_sent_by_me().id, 2);
});

View File

@ -6,8 +6,6 @@ const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
set_global("page_params", {});
set_global("setTimeout", (f, delay) => {
assert.equal(delay, 0);
return f();

View File

@ -6,14 +6,13 @@ const _ = require("lodash");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
set_global("document", "document-stub");
const noop = () => {};
const page_params = set_global("page_params", {
twenty_four_hour_time: false,
});
page_params.twenty_four_hour_time = false;
set_global("home_msg_list", "stub");
// timerender calls setInterval when imported
mock_esm("../../static/js/timerender", {

View File

@ -6,6 +6,7 @@ const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespa
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -19,10 +20,8 @@ mock_esm("../../static/js/recent_senders", {
set_global("document", "document-stub");
set_global("home_msg_list", {});
set_global("page_params", {
realm_allow_message_editing: true,
is_admin: true,
});
page_params.realm_allow_message_editing = true;
page_params.is_admin = true;
const util = zrequire("util");
const people = zrequire("people");

View File

@ -2,11 +2,10 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const page_params = set_global("page_params", {});
const {page_params} = require("../zjsunit/zpage_params");
const muting = zrequire("muting");
const stream_data = zrequire("stream_data");

View File

@ -2,13 +2,12 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
set_global("page_params", {
stop_words: ["what", "about"],
});
page_params.stop_words = ["what", "about"];
mock_cjs("jquery", $);
const stream_topic_history = mock_esm("../../static/js/stream_topic_history");

View File

@ -36,7 +36,6 @@ mock_esm("../../static/js/recent_topics", {
});
set_global("current_msg_list", {});
set_global("home_msg_list", {});
set_global("page_params", {});
//
// We have strange hacks in narrow.activate to sleep 0

View File

@ -2,11 +2,9 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
set_global("page_params", {});
const people = zrequire("people");
const {Filter} = zrequire("../js/filter");
const stream_data = zrequire("stream_data");

View File

@ -2,14 +2,13 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
mock_esm("../../static/js/muting", {
is_topic_muted: () => false,
});
set_global("page_params", {});
const {Filter} = zrequire("../js/filter");
const message_store = zrequire("message_store");

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
// Dependencies
@ -13,13 +14,11 @@ set_global("document", {
return true;
},
});
const page_params = set_global("page_params", {
is_admin: false,
realm_users: [],
enable_desktop_notifications: true,
enable_sounds: true,
wildcard_mentions_notify: true,
});
page_params.is_admin = false;
page_params.realm_users = [];
page_params.enable_desktop_notifications = true;
page_params.enable_sounds = true;
page_params.wildcard_mentions_notify = true;
const _navigator = {
userAgent: "Mozilla/5.0 AppleWebKit/537.36 Chrome/64.0.3282.167 Safari/537.36",
};

View File

@ -8,19 +8,18 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
const peer_data = zrequire("peer_data");
const people = zrequire("people");
const stream_data = zrequire("stream_data");
set_global("page_params", {
is_admin: false,
realm_users: [],
is_guest: false,
});
page_params.is_admin = false;
page_params.realm_users = [];
page_params.is_guest = false;
const me = {
email: "me@zulip.com",

View File

@ -7,12 +7,12 @@ const _ = require("lodash");
const MockDate = require("mockdate");
const {i18n} = require("../zjsunit/i18n");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
const message_store = mock_esm("../../static/js/message_store");
const page_params = set_global("page_params", {});
const people = zrequire("people");
const settings_config = zrequire("settings_config");

View File

@ -7,6 +7,7 @@ const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = function () {};
@ -28,11 +29,9 @@ mock_esm("../../static/js/stream_popover", {
});
set_global("current_msg_list", {});
set_global("page_params", {
is_admin: false,
realm_email_address_visibility: 3,
custom_profile_fields: [],
});
page_params.is_admin = false;
page_params.realm_email_address_visibility = 3;
page_params.custom_profile_fields = [];
const people = zrequire("people");
const user_status = zrequire("user_status");

View File

@ -8,6 +8,7 @@ const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const alice_user_id = 5;
@ -57,9 +58,7 @@ set_global("current_msg_list", {
},
});
set_global("document", "document-stub");
set_global("page_params", {
user_id: alice_user_id,
});
page_params.user_id = alice_user_id;
const emoji_codes = zrequire("../generated/emoji/emoji_codes.json");
const emoji = zrequire("../shared/js/emoji");

View File

@ -2,16 +2,17 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
mock_esm("../../static/js/rtl", {
get_direction: () => "ltr",
});
const page_params = set_global("page_params", {emojiset: "apple"});
page_params.emojiset = "apple";
const rm = zrequire("rendered_markdown");
const people = zrequire("people");

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -25,9 +26,7 @@ mock_esm("../../static/js/ui_util", {
place_caret_at_end: noop,
});
set_global("page_params", {
search_pills_enabled: true,
});
page_params.search_pills_enabled = true;
set_global("setTimeout", (func) => func());
const search = zrequire("search");

View File

@ -5,10 +5,9 @@ const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
set_global("page_params", {
search_pills_enabled: false,
});
page_params.search_pills_enabled = false;
const noop = () => {};

View File

@ -2,12 +2,11 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const page_params = set_global("page_params", {
search_pills_enabled: true,
});
page_params.search_pills_enabled = true;
mock_esm("../../static/js/message_store", {
user_ids: () => [],

View File

@ -2,12 +2,11 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const page_params = set_global("page_params", {
search_pills_enabled: false,
});
page_params.search_pills_enabled = false;
mock_esm("../../static/js/message_store", {
user_ids: () => [],
});

View File

@ -6,6 +6,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -31,7 +32,7 @@ set_global("home_msg_list", {
return 1;
},
});
set_global("page_params", {test_suite: false});
page_params.test_suite = false;
// we also directly write to pointer
set_global("pointer", {});

View File

@ -2,18 +2,17 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const page_params = set_global("page_params", {
realm_uri: "https://chat.example.com",
realm_embedded_bots: [
{name: "converter", config: {}},
{name: "giphy", config: {key: "12345678"}},
{name: "foobot", config: {bar: "baz", qux: "quux"}},
],
});
page_params.realm_uri = "https://chat.example.com";
page_params.realm_embedded_bots = [
{name: "converter", config: {}},
{name: "giphy", config: {key: "12345678"}},
{name: "foobot", config: {bar: "baz", qux: "quux"}},
];
const bot_data_params = {
realm_bots: [

View File

@ -2,10 +2,10 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const page_params = set_global("page_params", {});
const settings_config = zrequire("settings_config");
run_test("all_notifications", () => {

View File

@ -2,10 +2,9 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const page_params = set_global("page_params", {});
const {page_params} = require("../zjsunit/zpage_params");
const settings_data = zrequire("settings_data");
const settings_config = zrequire("settings_config");

View File

@ -8,6 +8,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -17,8 +18,6 @@ const _FormData = function () {
return form_data;
};
let page_params;
mock_cjs("jquery", $);
const realm_icon = mock_esm("../../static/js/realm_icon");
@ -62,14 +61,12 @@ const dropdown_list_widget = zrequire("dropdown_list_widget");
function test(label, f) {
run_test(label, (override) => {
page_params = set_global("page_params", {
is_admin: false,
realm_domains: [
{domain: "example.com", allow_subdomains: true},
{domain: "example.org", allow_subdomains: false},
],
realm_authentication_methods: {},
});
page_params.is_admin = false;
page_params.realm_domains = [
{domain: "example.com", allow_subdomains: true},
{domain: "example.org", allow_subdomains: false},
];
page_params.realm_authentication_methods = {};
settings_org.reset();
f(override);
});

View File

@ -3,13 +3,13 @@
const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
const loading = mock_esm("../../static/js/loading");
const page_params = set_global("page_params", {});
const SHORT_TEXT_ID = 1;

View File

@ -10,6 +10,7 @@ const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
@ -31,8 +32,6 @@ const user_groups = mock_esm("../../static/js/user_groups", {
});
const ui_report = mock_esm("../../static/js/ui_report");
const page_params = set_global("page_params", {});
const people = zrequire("people");
const settings_config = zrequire("settings_config");
const settings_user_groups = zrequire("settings_user_groups");

View File

@ -2,11 +2,10 @@
const {strict: assert} = require("assert");
const {with_overrides, set_global, zrequire} = require("../zjsunit/namespace");
const {with_overrides, zrequire} = require("../zjsunit/namespace");
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const page_params = set_global("page_params", {});
const {page_params} = require("../zjsunit/zpage_params");
const message_store = zrequire("message_store");
const starred_messages = zrequire("starred_messages");

View File

@ -4,11 +4,10 @@ const {strict: assert} = require("assert");
const _ = require("lodash");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
let page_params;
const {page_params} = require("../zjsunit/zpage_params");
const color_data = zrequire("color_data");
const stream_topic_history = zrequire("stream_topic_history");
@ -31,11 +30,9 @@ function contains_sub(subs, sub) {
function test(label, f) {
run_test(label, (override) => {
page_params = set_global("page_params", {
is_admin: false,
realm_users: [],
is_guest: false,
});
page_params.is_admin = false;
page_params.realm_users = [];
page_params.is_guest = false;
people.init();
people.add_active_user(me);
people.initialize_current_user(me.user_id);

View File

@ -3,14 +3,14 @@
const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
stub_templates(() => "<stub>");
const page_params = set_global("page_params", {});
mock_cjs("jquery", $);
const typeahead_helper = mock_esm("../../static/js/typeahead_helper");
const ui = mock_esm("../../static/js/ui", {

View File

@ -6,13 +6,12 @@ const {stub_templates} = require("../zjsunit/handlebars");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
set_global("document", "document-stub");
const page_params = set_global("page_params", {
is_admin: false,
realm_users: [],
});
page_params.is_admin = false;
page_params.realm_users = [];
const noop = () => {};

View File

@ -21,7 +21,6 @@ set_global("location", {
mock_esm("../../static/js/hash_util", {
by_stream_uri: () => {},
});
set_global("page_params", {});
const stream_data = zrequire("stream_data");
const subs = zrequire("subs");

View File

@ -6,13 +6,12 @@ const {add} = require("date-fns");
const MockDate = require("mockdate");
const {i18n} = require("../zjsunit/i18n");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
let page_params = set_global("page_params", {
twenty_four_hour_time: true,
});
page_params.twenty_four_hour_time = true;
mock_cjs("jquery", $);
@ -163,9 +162,7 @@ run_test("get_timestamp_for_flatpickr", () => {
});
run_test("absolute_time_12_hour", () => {
page_params = set_global("page_params", {
twenty_four_hour_time: false,
});
page_params.twenty_four_hour_time = false;
// timestamp with hour > 12, same year
let timestamp = 1555091573000; // 4/12/2019 5:52:53 PM (UTC+0)
@ -195,9 +192,7 @@ run_test("absolute_time_12_hour", () => {
});
run_test("absolute_time_24_hour", () => {
page_params = set_global("page_params", {
twenty_four_hour_time: true,
});
page_params.twenty_four_hour_time = true;
// timestamp with hour > 12, same year
let timestamp = 1555091573000; // 4/12/2019 5:52:53 PM (UTC+0)

View File

@ -2,13 +2,13 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
const page_params = set_global("page_params", {});
const channel = mock_esm("../../static/js/channel");
const reload = mock_esm("../../static/js/reload");
const reload_state = mock_esm("../../static/js/reload_state");

View File

@ -3,10 +3,11 @@
const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const page_params = set_global("page_params", {realm_is_zephyr_mirror_realm: false});
page_params.realm_is_zephyr_mirror_realm = false;
const settings_config = zrequire("settings_config");
const pm_conversations = zrequire("pm_conversations");

View File

@ -6,10 +6,9 @@ const _ = require("lodash");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
let page_params = set_global("page_params", {
realm_push_notifications_enabled: false,
});
page_params.realm_push_notifications_enabled = false;
const muting = zrequire("muting");
@ -47,19 +46,13 @@ function assert_zero_counts(counts) {
}
function test_notifiable_count(home_unread_messages, expected_notifiable_count) {
page_params = set_global("page_params", {
desktop_icon_count_display: 1,
});
page_params.desktop_icon_count_display = 1;
let notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, home_unread_messages);
page_params = set_global("page_params", {
desktop_icon_count_display: 2,
});
page_params.desktop_icon_count_display = 2;
notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, expected_notifiable_count);
page_params = set_global("page_params", {
desktop_icon_count_display: 3,
});
page_params.desktop_icon_count_display = 3;
notifiable_counts = unread.get_notifiable_count();
assert.deepEqual(notifiable_counts, 0);
}

View File

@ -8,6 +8,7 @@ const {JSDOM} = require("jsdom");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
const noop = () => {};
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
@ -18,12 +19,10 @@ const StripeCheckout = set_global("StripeCheckout", {
configure: noop,
});
set_global("page_params", {
annual_price: 8000,
monthly_price: 800,
seat_count: 8,
percent_off: 20,
});
page_params.annual_price = 8000;
page_params.monthly_price = 800;
page_params.seat_count = 8;
page_params.percent_off = 20;
mock_cjs("jquery", $);

View File

@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
set_global("document", {
location: {},
@ -12,9 +13,7 @@ set_global("document", {
set_global("navigator", {
userAgent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
});
const page_params = set_global("page_params", {
max_file_upload_size: 25,
});
page_params.max_file_upload_size = 25;
set_global("csrf_token", "csrf_token");
// Setting these up so that we can test that links to uploads within messages are

View File

@ -2,10 +2,11 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
mock_cjs("jquery", $);
const message_live_update = mock_esm("../../static/js/message_live_update");
@ -45,9 +46,7 @@ mock_esm("../../static/js/settings_users", {
update_user_data() {},
});
const page_params = set_global("page_params", {
is_admin: true,
});
page_params.is_admin = true;
const people = zrequire("people");
const settings_config = zrequire("settings_config");

View File

@ -2,10 +2,9 @@
const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const page_params = set_global("page_params", {});
const {page_params} = require("../zjsunit/zpage_params");
const people = zrequire("people");
const user_pill = zrequire("user_pill");

View File

@ -56,7 +56,7 @@ async function navigate_to_subscriptions(page: Page): Promise<void> {
}
async function test_reload_hash(page: Page): Promise<void> {
const initial_page_load_time = await page.evaluate(() => page_params.page_load_time);
const initial_page_load_time = await page.evaluate(() => zulip_test.page_params.page_load_time);
console.log("initial load time: " + initial_page_load_time);
const initial_hash = await page.evaluate(() => window.location.hash);
@ -65,7 +65,7 @@ async function test_reload_hash(page: Page): Promise<void> {
await page.waitForNavigation();
await page.waitForSelector("#zfilt", {visible: true});
const page_load_time = await page.evaluate(() => page_params.page_load_time);
const page_load_time = await page.evaluate(() => zulip_test.page_params.page_load_time);
assert(page_load_time > initial_page_load_time, "Page not reloaded.");
const hash = await page.evaluate(() => window.location.hash);

View File

@ -12,6 +12,7 @@ const namespace = require("./namespace");
const test = require("./test");
const blueslip = require("./zblueslip");
const zjquery = require("./zjquery");
const zpage_params = require("./zpage_params");
require("@babel/register")({
extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"],
@ -86,11 +87,14 @@ try {
namespace.set_global("setInterval", noop);
_.throttle = immediate;
_.debounce = immediate;
zpage_params.reset();
namespace.mock_esm("../../static/js/blueslip", blueslip);
require("../../static/js/blueslip");
namespace.mock_esm("../../static/js/i18n", stub_i18n);
require("../../static/js/i18n");
namespace.mock_esm("../../static/js/page_params", zpage_params);
require("../../static/js/page_params");
run_one_module(file);

View File

@ -0,0 +1,5 @@
"use strict";
exports.reset = () => {
exports.page_params = {};
};

View File

@ -8,6 +8,7 @@ import * as channel from "./channel";
import * as keydown_util from "./keydown_util";
import {ListCursor} from "./list_cursor";
import * as narrow from "./narrow";
import {page_params} from "./page_params";
import * as people from "./people";
import * as pm_list from "./pm_list";
import * as popovers from "./popovers";

View File

@ -5,6 +5,7 @@ import render_settings_organization_settings_tip from "../templates/settings/org
import {i18n} from "./i18n";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import * as settings from "./settings";
import * as settings_bots from "./settings_bots";
import * as settings_config from "./settings_config";

View File

@ -7,6 +7,7 @@ import * as channel from "./channel";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget";
import * as loading from "./loading";
import {page_params} from "./page_params";
import * as timerender from "./timerender";
import * as ui from "./ui";
import * as ui_report from "./ui_report";

View File

@ -5,6 +5,7 @@ import render_confirm_delete_user_avatar from "../templates/confirm_delete_user_
import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog";
import {i18n} from "./i18n";
import {page_params} from "./page_params";
import * as settings_data from "./settings_data";
import * as upload_widget from "./upload_widget";

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as loading from "../loading";
import {page_params} from "../page_params";
export function create_ajax_request(
url,

View File

@ -1,5 +1,7 @@
import $ from "jquery";
import {page_params} from "../page_params";
import * as helpers from "./helpers";
export const initialize = () => {

View File

@ -9,6 +9,7 @@
import $ from "jquery";
import * as blueslip_stacktrace from "./blueslip_stacktrace";
import {page_params} from "./page_params";
import * as ui_report from "./ui_report";
if (Error.stackTraceLimit !== undefined) {

View File

@ -2,6 +2,7 @@ import * as blueslip from "./blueslip";
import * as compose_fade_users from "./compose_fade_users";
import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import {page_params} from "./page_params";
import * as people from "./people";
import * as presence from "./presence";
import * as timerender from "./timerender";

View File

@ -1,8 +1,8 @@
import "core-js/features/promise";
import "core-js/features/symbol";
import "css.escape";
import "../webpack_public_path";
import "../../../tools/debug-require";
import "../page_params";
import "../csrf";
import "../blueslip";
import "../../third/bootstrap/js/bootstrap";

View File

@ -27,6 +27,7 @@ import * as muting_ui from "./muting_ui";
import * as narrow from "./narrow";
import * as notifications from "./notifications";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import * as popovers from "./popovers";
import * as reactions from "./reactions";
import * as recent_topics from "./recent_topics";

View File

@ -22,6 +22,7 @@ import {i18n} from "./i18n";
import * as loading from "./loading";
import * as markdown from "./markdown";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as peer_data from "./peer_data";
import * as people from "./people";
import * as reminder from "./reminder";

View File

@ -16,6 +16,7 @@ import {i18n} from "./i18n";
import * as message_viewport from "./message_viewport";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as people from "./people";
import * as reload_state from "./reload_state";
import * as stream_bar from "./stream_bar";

View File

@ -15,6 +15,7 @@ import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
import * as message_store from "./message_store";
import {page_params} from "./page_params";
import * as people from "./people";
import * as rows from "./rows";
import * as settings_data from "./settings_data";

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import TurndownService from "turndown/lib/turndown.cjs";
import * as compose_ui from "./compose_ui";
import {page_params} from "./page_params";
import * as rows from "./rows";
function find_boundary_tr(initial_tr, iterate_row) {

View File

@ -9,6 +9,7 @@ import * as message_list from "./message_list";
import * as message_store from "./message_store";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as people from "./people";
import * as pm_list from "./pm_list";
import * as popovers from "./popovers";

View File

@ -4,6 +4,8 @@ import twitter_sheet from "emoji-datasource-twitter/img/twitter/sheets-256/64.pn
import octopus_url from "../generated/emoji/images-google-64/1f419.png";
import {page_params} from "./page_params";
import google_blob_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-blob-sprite.css";
import google_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-sprite.css";
import twitter_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/twitter-sprite.css";

View File

@ -4,6 +4,7 @@ import _ from "lodash";
import {i18n} from "./i18n";
import * as message_parser from "./message_parser";
import * as message_store from "./message_store";
import {page_params} from "./page_params";
import * as people from "./people";
import * as stream_data from "./stream_data";
import * as unread from "./unread";

View File

@ -4,6 +4,7 @@ import * as hashchange from "./hashchange";
import {i18n} from "./i18n";
import * as message_viewport from "./message_viewport";
import * as navigate from "./navigate";
import {page_params} from "./page_params";
/*
For various historical reasons there isn't one

View File

@ -6,7 +6,6 @@
declare let csrf_token: any;
declare let current_msg_list: any;
declare let home_msg_list: any;
declare let page_params: any;
declare let zulip_test: any;
interface JQuery {

View File

@ -12,6 +12,7 @@ import * as message_viewport from "./message_viewport";
import * as narrow from "./narrow";
import * as navigate from "./navigate";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import * as recent_topics from "./recent_topics";
import * as search from "./search";
import * as settings from "./settings";

View File

@ -25,6 +25,7 @@ import * as muting_ui from "./muting_ui";
import * as narrow from "./narrow";
import * as navigate from "./navigate";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import * as popovers from "./popovers";
import * as reactions from "./reactions";
import * as recent_topics from "./recent_topics";

View File

@ -7,6 +7,7 @@ import render_intro_reply_hotspot from "../templates/intro_reply_hotspot.hbs";
import * as blueslip from "./blueslip";
import * as channel from "./channel";
import {page_params} from "./page_params";
import * as popovers from "./popovers";
// popover orientations

View File

@ -3,6 +3,8 @@
import i18next from "i18next";
import {page_params} from "./page_params";
i18next.init({
lng: "lang",
resources: {

View File

@ -12,6 +12,7 @@ import * as channel from "./channel";
import * as common from "./common";
import {i18n} from "./i18n";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import * as stream_data from "./stream_data";
import * as ui from "./ui";
import * as ui_report from "./ui_report";

View File

@ -1,6 +1,7 @@
import * as blueslip from "./blueslip";
import * as message_events from "./message_events";
import * as message_list from "./message_list";
import {page_params} from "./page_params";
function truncate_precision(float) {
return Number.parseFloat(float.toFixed(3));

View File

@ -1,4 +1,5 @@
import * as hash_util from "./hash_util";
import {page_params} from "./page_params";
import * as people from "./people";
import * as stream_data from "./stream_data";
import * as user_groups from "./user_groups";

View File

@ -16,6 +16,7 @@ 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 {page_params} from "./page_params";
import * as resize from "./resize";
import * as rows from "./rows";
import * as stream_bar from "./stream_bar";

View File

@ -14,6 +14,7 @@ import * as message_util from "./message_util";
import * as narrow from "./narrow";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as pm_list from "./pm_list";
import * as recent_senders from "./recent_senders";
import * as recent_topics from "./recent_topics";

View File

@ -8,6 +8,7 @@ import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store";
import * as message_util from "./message_util";
import * as narrow from "./narrow";
import {page_params} from "./page_params";
import * as people from "./people";
import * as pm_list from "./pm_list";
import * as recent_topics from "./recent_topics";

View File

@ -7,6 +7,7 @@ import {MessageListData} from "./message_list_data";
import {MessageListView} from "./message_list_view";
import * as narrow from "./narrow";
import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params";
import * as stream_data from "./stream_data";
export let narrowed;

View File

@ -4,6 +4,7 @@ import * as blueslip from "./blueslip";
import {FetchStatus} from "./fetch_status";
import {Filter} from "./filter";
import * as muting from "./muting";
import {page_params} from "./page_params";
import * as unread from "./unread";
import * as util from "./util";

View File

@ -19,6 +19,7 @@ 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 {page_params} from "./page_params";
import * as people from "./people";
import * as popovers from "./popovers";
import * as reactions from "./reactions";

View File

@ -4,6 +4,7 @@ import render_message_view_header from "../templates/message_view_header.hbs";
import {i18n} from "./i18n";
import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params";
import * as peer_data from "./peer_data";
import * as recent_topics from "./recent_topics";
import * as rendered_markdown from "./rendered_markdown";

View File

@ -1,5 +1,6 @@
import * as blueslip from "./blueslip";
import {FoldDict} from "./fold_dict";
import {page_params} from "./page_params";
import * as stream_data from "./stream_data";
import * as timerender from "./timerender";

View File

@ -19,6 +19,7 @@ import * as message_store from "./message_store";
import * as message_view_header from "./message_view_header";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as people from "./people";
import * as recent_topics from "./recent_topics";
import * as resize from "./resize";

Some files were not shown because too many files have changed in this diff Show More