Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

js: Rename night_mode.ts to dark_theme.ts.

Sahil Batra0a949274e97e
diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js
index baf57ad4c2f..a906be04045 100644
--- a/frontend_tests/node_tests/dispatch.js
+++ b/frontend_tests/node_tests/dispatch.js
@@ -30,6 +30,7 @@ const attachments_ui = mock_esm("../../static/js/attachments_ui");
const bot_data = mock_esm("../../static/js/bot_data");
const compose = mock_esm("../../static/js/compose");
const composebox_typeahead = mock_esm("../../static/js/composebox_typeahead");
+const dark_theme = mock_esm("../../static/js/dark_theme");
const emoji_picker = mock_esm("../../static/js/emoji_picker");
const hotspots = mock_esm("../../static/js/hotspots");
const linkifiers = mock_esm("../../static/js/linkifiers");
@@ -39,7 +40,6 @@ const message_list = mock_esm("../../static/js/message_list");
const message_lists = mock_esm("../../static/js/message_lists");
const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui");
const muted_users_ui = mock_esm("../../static/js/muted_users_ui");
-const night_mode = mock_esm("../../static/js/night_mode");
const notifications = mock_esm("../../static/js/notifications");
const reactions = mock_esm("../../static/js/reactions");
const realm_icon = mock_esm("../../static/js/realm_icon");
@@ -732,7 +732,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_dark;
user_settings.color_scheme = 1;
- override(night_mode, "enable", stub.f); // automatically checks if called
+ override(dark_theme, "enable", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 2);
@@ -742,7 +742,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_light;
user_settings.color_scheme = 1;
- override(night_mode, "disable", stub.f); // automatically checks if called
+ override(dark_theme, "disable", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 3);
@@ -766,7 +766,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_automatic;
user_settings.color_scheme = 2;
- override(night_mode, "default_preference_checker", stub.f); // automatically checks if called
+ override(dark_theme, "default_preference_checker", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 1);
diff --git a/static/js/night_mode.ts b/static/js/dark_theme.ts
similarity index 100%
rename from static/js/night_mode.ts
rename to static/js/dark_theme.ts
diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js
index 2b4023a9986..e93776a905c 100644
--- a/static/js/server_events_dispatch.js
+++ b/static/js/server_events_dispatch.js
@@ -13,6 +13,7 @@ import * as compose_actions from "./compose_actions";
import * as compose_fade from "./compose_fade";
import * as compose_pm_pill from "./compose_pm_pill";
import * as composebox_typeahead from "./composebox_typeahead";
+import * as dark_theme from "./dark_theme";
import * as emoji_picker from "./emoji_picker";
import * as giphy from "./giphy";
import * as hotspots from "./hotspots";
@@ -26,7 +27,6 @@ import * as muted_topics_ui from "./muted_topics_ui";
import * as muted_users_ui from "./muted_users_ui";
import * as narrow_state from "./narrow_state";
import * as navbar_alerts from "./navbar_alerts";
-import * as night_mode from "./night_mode";
import * as notifications from "./notifications";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
@@ -624,13 +624,13 @@ export function dispatch_normal_event(event) {
$("body").fadeOut(300);
setTimeout(() => {
if (event.value === settings_config.color_scheme_values.night.code) {
- night_mode.enable();
+ dark_theme.enable();
realm_logo.render();
} else if (event.value === settings_config.color_scheme_values.day.code) {
- night_mode.disable();
+ dark_theme.disable();
realm_logo.render();
} else {
- night_mode.default_preference_checker();
+ dark_theme.default_preference_checker();
realm_logo.render();
}
$("body").fadeIn(300);
diff --git a/static/js/zcommand.js b/static/js/zcommand.js
index 607fa663ff5..44a66e46b10 100644
--- a/static/js/zcommand.js
+++ b/static/js/zcommand.js
@@ -4,9 +4,9 @@ import marked from "../third/marked/lib/marked";
import * as channel from "./channel";
import * as common from "./common";
+import * as dark_theme from "./dark_theme";
import * as feedback_widget from "./feedback_widget";
import {$t} from "./i18n";
-import * as night_mode from "./night_mode";
import * as scroll_bar from "./scroll_bar";
/*
@@ -63,7 +63,7 @@ export function enter_day_mode() {
send({
command: "/day",
on_success(data) {
- night_mode.disable();
+ dark_theme.disable();
feedback_widget.show({
populate(container) {
const rendered_msg = marked(data.msg).trim();
@@ -85,7 +85,7 @@ export function enter_night_mode() {
send({
command: "/night",
on_success(data) {
- night_mode.enable();
+ dark_theme.enable();
feedback_widget.show({
populate(container) {
const rendered_msg = marked(data.msg).trim();
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 43fc5a055c2..0f1b2f2cc1d 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -59,6 +59,7 @@ EXEMPT_FILES = {
"static/js/copy_and_paste.js",
"static/js/csrf.ts",
"static/js/css_variables.js",
+ "static/js/dark_theme.ts",
"static/js/debug.js",
"static/js/deprecated_feature_notice.js",
"static/js/desktop_integration.js",
@@ -101,7 +102,6 @@ EXEMPT_FILES = {
"static/js/muted_users_ui.js",
"static/js/narrow.js",
"static/js/navigate.js",
- "static/js/night_mode.ts",
"static/js/notifications.js",
"static/js/overlays.js",
"static/js/padded_widget.ts",