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: Convert static/js/settings_config.js to ES6 module.

Anders Kaseorgfc2900c0044e
diff --git a/static/js/settings_config.js b/static/js/settings_config.js
index bb586be3a20..2b9773e0f6b 100644
--- a/static/js/settings_config.js
+++ b/static/js/settings_config.js
@@ -1,5 +1,3 @@
-"use strict";
-
/*
This file contains translations between the integer values used in
the Zulip API to describe values in dropdowns, radio buttons, and
@@ -14,7 +12,7 @@
API documentation) without a ton of copying.
*/
-exports.demote_inactive_streams_values = {
+export const demote_inactive_streams_values = {
automatic: {
code: 1,
description: i18n.t("Automatic"),
@@ -29,7 +27,7 @@ exports.demote_inactive_streams_values = {
},
};
-exports.color_scheme_values = {
+export const color_scheme_values = {
automatic: {
code: 1,
description: i18n.t("Automatic"),
@@ -44,7 +42,7 @@ exports.color_scheme_values = {
},
};
-exports.twenty_four_hour_time_values = {
+export const twenty_four_hour_time_values = {
twenty_four_hour_clock: {
value: true,
description: i18n.t("24-hour clock (17:00)"),
@@ -55,7 +53,7 @@ exports.twenty_four_hour_time_values = {
},
};
-exports.get_all_display_settings = () => ({
+export const get_all_display_settings = () => ({
settings: {
user_display_settings: [
"dense_mode",
@@ -71,7 +69,7 @@ exports.get_all_display_settings = () => ({
},
});
-exports.email_address_visibility_values = {
+export const email_address_visibility_values = {
everyone: {
code: 1,
description: i18n.t("Admins, members, and guests"),
@@ -91,7 +89,7 @@ exports.email_address_visibility_values = {
},
};
-exports.create_stream_policy_values = {
+export const create_stream_policy_values = {
by_admins_only: {
order: 1,
code: 2,
@@ -109,9 +107,9 @@ exports.create_stream_policy_values = {
},
};
-exports.invite_to_stream_policy_values = exports.create_stream_policy_values;
+export const invite_to_stream_policy_values = create_stream_policy_values;
-exports.user_group_edit_policy_values = {
+export const user_group_edit_policy_values = {
by_admins_only: {
order: 1,
code: 2,
@@ -124,7 +122,7 @@ exports.user_group_edit_policy_values = {
},
};
-exports.private_message_policy_values = {
+export const private_message_policy_values = {
by_anyone: {
order: 1,
code: 1,
@@ -137,7 +135,7 @@ exports.private_message_policy_values = {
},
};
-exports.wildcard_mention_policy_values = {
+export const wildcard_mention_policy_values = {
by_everyone: {
order: 1,
code: 1,
@@ -230,12 +228,11 @@ const time_limit_dropdown_values = new Map([
},
],
]);
-exports.msg_edit_limit_dropdown_values = time_limit_dropdown_values;
-exports.msg_delete_limit_dropdown_values = time_limit_dropdown_values;
-
-exports.retain_message_forever = -1;
+export const msg_edit_limit_dropdown_values = time_limit_dropdown_values;
+export const msg_delete_limit_dropdown_values = time_limit_dropdown_values;
+export const retain_message_forever = -1;
-exports.user_role_values = {
+export const user_role_values = {
guest: {
code: 600,
description: i18n.t("Guest"),
@@ -254,12 +251,12 @@ exports.user_role_values = {
},
};
-const user_role_array = Object.values(exports.user_role_values);
-exports.user_role_map = new Map(user_role_array.map((role) => [role.code, role.description]));
+const user_role_array = Object.values(user_role_values);
+export const user_role_map = new Map(user_role_array.map((role) => [role.code, role.description]));
// NOTIFICATIONS
-exports.general_notifications_table_labels = {
+export const general_notifications_table_labels = {
realm: [
/* An array of notification settings of any category like
* `stream_notification_settings` which makes a single row of
@@ -282,7 +279,7 @@ exports.general_notifications_table_labels = {
},
};
-exports.stream_specific_notification_settings = [
+export const stream_specific_notification_settings = [
"desktop_notifications",
"audible_notifications",
"push_notifications",
@@ -290,7 +287,7 @@ exports.stream_specific_notification_settings = [
"wildcard_mentions_notify",
];
-exports.stream_notification_settings = [
+export const stream_notification_settings = [
"enable_stream_desktop_notifications",
"enable_stream_audible_notifications",
"enable_stream_push_notifications",
@@ -326,17 +323,17 @@ const other_notification_settings = desktop_notification_settings.concat(
["notification_sound"],
);
-exports.all_notification_settings = other_notification_settings.concat(
+export const all_notification_settings = other_notification_settings.concat(
pm_mention_notification_settings,
- exports.stream_notification_settings,
+ stream_notification_settings,
);
-exports.all_notifications = () => ({
+export const all_notifications = () => ({
general_settings: [
{
label: i18n.t("Streams"),
notification_settings: settings_notifications.get_notifications_table_row_data(
- exports.stream_notification_settings,
+ stream_notification_settings,
),
},
{
@@ -405,4 +402,4 @@ const map_language_to_playground_info = {
],
};
-exports.get_playground_info_for_languages = (lang) => map_language_to_playground_info[lang];
+export const get_playground_info_for_languages = (lang) => map_language_to_playground_info[lang];
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 9c4c951f5e4..0e3b0049390 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -117,7 +117,6 @@ EXEMPT_FILES = {
'static/js/dropdown_list_widget.js',
'static/js/settings_account.js',
'static/js/settings_bots.js',
- 'static/js/settings_config.js',
'static/js/settings_display.js',
'static/js/settings_emoji.js',
'static/js/settings_exports.js',