mirror of https://github.com/zulip/zulip.git
js: Convert static/js/settings_notifications.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
4d738ebe15
commit
7a1ce36d4f
|
@ -161,7 +161,6 @@
|
|||
"settings_exports": false,
|
||||
"settings_linkifiers": false,
|
||||
"settings_invites": false,
|
||||
"settings_notifications": false,
|
||||
"settings_org": false,
|
||||
"settings_profile_fields": false,
|
||||
"settings_sections": false,
|
||||
|
|
|
@ -64,7 +64,8 @@ const settings_emoji = set_global("settings_emoji", {});
|
|||
const settings_exports = set_global("settings_exports", {});
|
||||
const settings_invites = set_global("settings_invites", {});
|
||||
const settings_linkifiers = set_global("settings_linkifiers", {});
|
||||
const settings_notifications = set_global("settings_notifications", {});
|
||||
const settings_notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_notifications").with(settings_notifications);
|
||||
const settings_org = set_global("settings_org", {});
|
||||
const settings_profile_fields = set_global("settings_profile_fields", {});
|
||||
const settings_streams = set_global("settings_streams", {});
|
||||
|
|
|
@ -22,7 +22,7 @@ rewiremock("../../static/js/list_widget").with({
|
|||
create: () => ({init: noop}),
|
||||
});
|
||||
const page_params = set_global("page_params", {});
|
||||
set_global("settings_notifications", {
|
||||
rewiremock("../../static/js/settings_notifications").with({
|
||||
get_notifications_table_row_data: noop,
|
||||
});
|
||||
rewiremock("../../static/js/stream_color").with({
|
||||
|
|
|
@ -11,9 +11,10 @@ const $ = require("../zjsunit/zjquery");
|
|||
|
||||
const noop = () => {};
|
||||
const _settings_notifications = {
|
||||
__esModule: true,
|
||||
update_page: () => {},
|
||||
};
|
||||
set_global("settings_notifications", _settings_notifications);
|
||||
rewiremock("../../static/js/settings_notifications").with(_settings_notifications);
|
||||
|
||||
const color_data = {__esModule: true};
|
||||
rewiremock("../../static/js/color_data").with(color_data);
|
||||
|
|
|
@ -25,7 +25,6 @@ const muting = zrequire("muting");
|
|||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const unread = zrequire("unread");
|
||||
zrequire("settings_notifications");
|
||||
const {FoldDict} = zrequire("fold_dict");
|
||||
|
||||
const me = {
|
||||
|
|
|
@ -35,7 +35,6 @@ import "../server_events";
|
|||
import "../zulip";
|
||||
import "../templates";
|
||||
import "../dropdown_list_widget";
|
||||
import "../settings_notifications";
|
||||
import "../settings_bots";
|
||||
import "../settings_sections";
|
||||
import "../settings_emoji";
|
||||
|
|
|
@ -33,7 +33,6 @@ declare let settings_emoji: any;
|
|||
declare let settings_exports: any;
|
||||
declare let settings_invites: any;
|
||||
declare let settings_linkifiers: any;
|
||||
declare let settings_notifications: any;
|
||||
declare let settings_org: any;
|
||||
declare let settings_profile_fields: any;
|
||||
declare let settings_sections: any;
|
||||
|
|
|
@ -24,6 +24,7 @@ import * as scroll_bar from "./scroll_bar";
|
|||
import * as settings_account from "./settings_account";
|
||||
import * as settings_config from "./settings_config";
|
||||
import * as settings_display from "./settings_display";
|
||||
import * as settings_notifications from "./settings_notifications";
|
||||
import * as starred_messages from "./starred_messages";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_events from "./stream_events";
|
||||
|
|
|
@ -7,6 +7,7 @@ const overlays = require("./overlays");
|
|||
const people = require("./people");
|
||||
const settings_account = require("./settings_account");
|
||||
const settings_config = require("./settings_config");
|
||||
const settings_notifications = require("./settings_notifications");
|
||||
const settings_panel_menu = require("./settings_panel_menu");
|
||||
const settings_toggle = require("./settings_toggle");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as settings_notifications from "./settings_notifications";
|
||||
/*
|
||||
This file contains translations between the integer values used in
|
||||
the Zulip API to describe values in dropdowns, radio buttons, and
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
"use strict";
|
||||
import render_stream_specific_notification_row from "../templates/settings/stream_specific_notification_row.hbs";
|
||||
|
||||
const render_stream_specific_notification_row = require("../templates/settings/stream_specific_notification_row.hbs");
|
||||
import * as channel from "./channel";
|
||||
import * as notifications from "./notifications";
|
||||
import * as settings_config from "./settings_config";
|
||||
import * as settings_ui from "./settings_ui";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_edit from "./stream_edit";
|
||||
import * as unread_ui from "./unread_ui";
|
||||
|
||||
const channel = require("./channel");
|
||||
const notifications = require("./notifications");
|
||||
const settings_config = require("./settings_config");
|
||||
const settings_ui = require("./settings_ui");
|
||||
const stream_data = require("./stream_data");
|
||||
const stream_edit = require("./stream_edit");
|
||||
const unread_ui = require("./unread_ui");
|
||||
|
||||
exports.get_notifications_table_row_data = function (notify_settings) {
|
||||
export function get_notifications_table_row_data(notify_settings) {
|
||||
return settings_config.general_notifications_table_labels.realm.map((column, index) => {
|
||||
const setting_name = notify_settings[index];
|
||||
if (setting_name === undefined) {
|
||||
|
@ -30,9 +28,9 @@ exports.get_notifications_table_row_data = function (notify_settings) {
|
|||
checkbox.is_checked = page_params[setting_name];
|
||||
return checkbox;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.desktop_icon_count_display_values = {
|
||||
export const desktop_icon_count_display_values = {
|
||||
messages: {
|
||||
code: 1,
|
||||
description: i18n.t("All unreads"),
|
||||
|
@ -92,15 +90,15 @@ function update_desktop_icon_count_display() {
|
|||
unread_ui.update_unread_counts();
|
||||
}
|
||||
|
||||
exports.set_enable_digest_emails_visibility = function () {
|
||||
export function set_enable_digest_emails_visibility() {
|
||||
if (page_params.realm_digest_emails_enabled) {
|
||||
$("#enable_digest_emails_label").parent().show();
|
||||
} else {
|
||||
$("#enable_digest_emails_label").parent().hide();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.set_up = function () {
|
||||
export function set_up() {
|
||||
$("#notification-settings").on("change", "input, select", function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -144,11 +142,11 @@ exports.set_up = function () {
|
|||
notification_sound_dropdown.parent().addClass("control-label-disabled");
|
||||
}
|
||||
});
|
||||
exports.set_enable_digest_emails_visibility();
|
||||
set_enable_digest_emails_visibility();
|
||||
rerender_ui();
|
||||
};
|
||||
}
|
||||
|
||||
exports.update_page = function () {
|
||||
export function update_page() {
|
||||
for (const setting of settings_config.all_notification_settings) {
|
||||
if (
|
||||
setting === "enable_offline_push_notifications" &&
|
||||
|
@ -165,6 +163,4 @@ exports.update_page = function () {
|
|||
$(`#${CSS.escape(setting)}`).prop("checked", page_params[setting]);
|
||||
}
|
||||
rerender_ui();
|
||||
};
|
||||
|
||||
window.settings_notifications = exports;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ const overlays = require("./overlays");
|
|||
const realm_icon = require("./realm_icon");
|
||||
const realm_logo = require("./realm_logo");
|
||||
const settings_config = require("./settings_config");
|
||||
const settings_notifications = require("./settings_notifications");
|
||||
const settings_ui = require("./settings_ui");
|
||||
const stream_data = require("./stream_data");
|
||||
const ui_report = require("./ui_report");
|
||||
|
|
|
@ -5,6 +5,7 @@ const attachments_ui = require("./attachments_ui");
|
|||
const settings_account = require("./settings_account");
|
||||
const settings_display = require("./settings_display");
|
||||
const settings_muting = require("./settings_muting");
|
||||
const settings_notifications = require("./settings_notifications");
|
||||
|
||||
const load_func_dict = new Map(); // group -> function
|
||||
const loaded_groups = new Set();
|
||||
|
|
|
@ -3,6 +3,7 @@ import * as message_util from "./message_util";
|
|||
import * as narrow_state from "./narrow_state";
|
||||
import * as overlays from "./overlays";
|
||||
import * as peer_data from "./peer_data";
|
||||
import * as settings_notifications from "./settings_notifications";
|
||||
import * as stream_color from "./stream_color";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_muting from "./stream_muting";
|
||||
|
|
|
@ -4,6 +4,7 @@ const {FoldDict} = require("./fold_dict");
|
|||
const message_store = require("./message_store");
|
||||
const muting = require("./muting");
|
||||
const people = require("./people");
|
||||
const settings_notifications = require("./settings_notifications");
|
||||
const stream_data = require("./stream_data");
|
||||
const util = require("./util");
|
||||
|
||||
|
|
Loading…
Reference in New Issue