2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2020-02-21 14:26:11 +01:00
|
|
|
/*
|
|
|
|
This file contains translations between the integer values used in
|
|
|
|
the Zulip API to describe values in dropdowns, radio buttons, and
|
|
|
|
similar widgets and the user-facing strings that should be used to
|
|
|
|
describe them, as well as data details like sort orders that may
|
|
|
|
be useful for some widgets.
|
|
|
|
|
|
|
|
We plan to eventually transition much of this file to have a more
|
|
|
|
standard format and then to be populated using data sent from the
|
|
|
|
Zulip server in `page_params`, so that the data is available for
|
|
|
|
other parts of the ecosystem to use (including the mobile apps and
|
|
|
|
API documentation) without a ton of copying.
|
|
|
|
*/
|
|
|
|
|
|
|
|
exports.demote_inactive_streams_values = {
|
|
|
|
automatic: {
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Automatic"),
|
|
|
|
},
|
|
|
|
always: {
|
|
|
|
code: 2,
|
|
|
|
description: i18n.t("Always"),
|
|
|
|
},
|
|
|
|
never: {
|
|
|
|
code: 3,
|
|
|
|
description: i18n.t("Never"),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-05-16 13:13:59 +02:00
|
|
|
exports.color_scheme_values = {
|
|
|
|
automatic: {
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Automatic"),
|
|
|
|
},
|
|
|
|
night: {
|
|
|
|
code: 2,
|
|
|
|
description: i18n.t("Night mode"),
|
|
|
|
},
|
|
|
|
day: {
|
|
|
|
code: 3,
|
|
|
|
description: i18n.t("Day mode"),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-02-21 14:26:11 +01:00
|
|
|
exports.twenty_four_hour_time_values = {
|
|
|
|
twenty_four_hour_clock: {
|
|
|
|
value: true,
|
|
|
|
description: i18n.t("24-hour clock (17:00)"),
|
|
|
|
},
|
|
|
|
twelve_hour_clock: {
|
|
|
|
value: false,
|
|
|
|
description: i18n.t("12-hour clock (5:00 PM)"),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.get_all_display_settings = () => ({
|
|
|
|
settings: {
|
|
|
|
user_display_settings: [
|
|
|
|
"dense_mode",
|
|
|
|
"high_contrast_mode",
|
|
|
|
"left_side_userlist",
|
|
|
|
"starred_message_counts",
|
|
|
|
"fluid_layout_width",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
render_only: {
|
|
|
|
high_contrast_mode: page_params.development_environment,
|
|
|
|
dense_mode: page_params.development_environment,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-02-21 20:46:35 +01:00
|
|
|
exports.email_address_visibility_values = {
|
|
|
|
everyone: {
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Admins, members, and guests"),
|
|
|
|
},
|
|
|
|
//// Backend support for this configuration is not available yet.
|
|
|
|
// admins_and_members: {
|
|
|
|
// code: 2,
|
|
|
|
// description: i18n.t("Members and admins"),
|
|
|
|
// },
|
|
|
|
admins_only: {
|
|
|
|
code: 3,
|
|
|
|
description: i18n.t("Admins only"),
|
|
|
|
},
|
2020-03-07 01:15:34 +01:00
|
|
|
nobody: {
|
|
|
|
code: 4,
|
|
|
|
description: i18n.t("Nobody"),
|
|
|
|
},
|
2020-02-21 20:46:35 +01:00
|
|
|
};
|
2020-02-21 20:58:17 +01:00
|
|
|
|
|
|
|
exports.create_stream_policy_values = {
|
|
|
|
by_admins_only: {
|
|
|
|
order: 1,
|
|
|
|
code: 2,
|
|
|
|
description: i18n.t("Admins"),
|
|
|
|
},
|
|
|
|
by_full_members: {
|
|
|
|
order: 2,
|
|
|
|
code: 3,
|
|
|
|
description: i18n.t("Admins and full members"),
|
|
|
|
},
|
|
|
|
by_members: {
|
|
|
|
order: 3,
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Admins and members"),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.invite_to_stream_policy_values = exports.create_stream_policy_values;
|
2020-02-21 21:40:29 +01:00
|
|
|
|
|
|
|
exports.user_group_edit_policy_values = {
|
|
|
|
by_admins_only: {
|
|
|
|
order: 1,
|
|
|
|
code: 2,
|
|
|
|
description: i18n.t("Admins"),
|
|
|
|
},
|
|
|
|
by_members: {
|
|
|
|
order: 2,
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Admins and members"),
|
|
|
|
},
|
|
|
|
};
|
2020-02-21 21:42:27 +01:00
|
|
|
|
|
|
|
exports.private_message_policy_values = {
|
|
|
|
by_anyone: {
|
|
|
|
order: 1,
|
|
|
|
code: 1,
|
|
|
|
description: i18n.t("Admins, members, and guests"),
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
order: 2,
|
|
|
|
code: 2,
|
|
|
|
description: i18n.t("Private messages disabled"),
|
|
|
|
},
|
|
|
|
};
|
2020-02-21 21:45:34 +01:00
|
|
|
|
2020-02-09 05:23:25 +01:00
|
|
|
const time_limit_dropdown_values = new Map([
|
2020-07-15 00:34:28 +02:00
|
|
|
[
|
|
|
|
"any_time",
|
|
|
|
{
|
|
|
|
text: i18n.t("Any time"),
|
|
|
|
seconds: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"never",
|
|
|
|
{
|
|
|
|
text: i18n.t("Never"),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"upto_two_min",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("2 minutes")}),
|
|
|
|
seconds: 2 * 60,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"upto_ten_min",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("10 minutes")}),
|
|
|
|
seconds: 10 * 60,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"upto_one_hour",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 hour")}),
|
|
|
|
seconds: 60 * 60,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"upto_one_day",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 day")}),
|
|
|
|
seconds: 24 * 60 * 60,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"upto_one_week",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to __time_limit__ after posting", {time_limit: i18n.t("1 week")}),
|
|
|
|
seconds: 7 * 24 * 60 * 60,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"custom_limit",
|
|
|
|
{
|
|
|
|
text: i18n.t("Up to N minutes after posting"),
|
|
|
|
},
|
|
|
|
],
|
2020-02-09 05:23:25 +01:00
|
|
|
]);
|
2020-02-21 21:45:34 +01:00
|
|
|
exports.msg_edit_limit_dropdown_values = time_limit_dropdown_values;
|
|
|
|
exports.msg_delete_limit_dropdown_values = time_limit_dropdown_values;
|
2020-03-28 18:03:43 +01:00
|
|
|
|
2020-05-07 13:19:54 +02:00
|
|
|
exports.retain_message_forever = -1;
|
2020-03-28 18:03:43 +01:00
|
|
|
|
2020-05-29 16:12:09 +02:00
|
|
|
exports.user_role_values = {
|
|
|
|
guest: {
|
|
|
|
code: 600,
|
|
|
|
description: i18n.t("Guest"),
|
|
|
|
},
|
|
|
|
member: {
|
|
|
|
code: 400,
|
|
|
|
description: i18n.t("Member"),
|
|
|
|
},
|
|
|
|
admin: {
|
|
|
|
code: 200,
|
|
|
|
description: i18n.t("Administrator"),
|
|
|
|
},
|
2020-06-03 23:30:34 +02:00
|
|
|
owner: {
|
|
|
|
code: 100,
|
|
|
|
description: i18n.t("Owner"),
|
|
|
|
},
|
2020-05-29 16:12:09 +02:00
|
|
|
};
|
|
|
|
|
2020-06-23 15:32:18 +02:00
|
|
|
const user_role_array = Object.values(exports.user_role_values);
|
2020-07-02 01:39:34 +02:00
|
|
|
exports.user_role_map = new Map(user_role_array.map((role) => [role.code, role.description]));
|
2020-06-23 15:32:18 +02:00
|
|
|
|
2020-03-28 18:03:43 +01:00
|
|
|
// NOTIFICATIONS
|
|
|
|
|
2020-04-01 19:43:34 +02:00
|
|
|
exports.general_notifications_table_labels = {
|
|
|
|
realm: [
|
|
|
|
/* An array of notification settings of any category like
|
2020-07-15 00:34:28 +02:00
|
|
|
* `stream_notification_settings` which makes a single row of
|
|
|
|
* "Notification triggers" table should follow this order
|
|
|
|
*/
|
|
|
|
"visual",
|
|
|
|
"audio",
|
|
|
|
"mobile",
|
|
|
|
"email",
|
|
|
|
"all_mentions",
|
2020-04-01 19:43:34 +02:00
|
|
|
],
|
|
|
|
stream: {
|
|
|
|
is_muted: i18n.t("Mute stream"),
|
|
|
|
desktop_notifications: i18n.t("Visual desktop notifications"),
|
|
|
|
audible_notifications: i18n.t("Audible desktop notifications"),
|
|
|
|
push_notifications: i18n.t("Mobile notifications"),
|
|
|
|
email_notifications: i18n.t("Email notifications"),
|
|
|
|
pin_to_top: i18n.t("Pin stream to top of left sidebar"),
|
|
|
|
wildcard_mentions_notify: i18n.t("Notifications for @all/@everyone mentions"),
|
|
|
|
},
|
|
|
|
};
|
2020-03-28 18:03:43 +01:00
|
|
|
|
|
|
|
exports.stream_specific_notification_settings = [
|
|
|
|
"desktop_notifications",
|
|
|
|
"audible_notifications",
|
|
|
|
"push_notifications",
|
|
|
|
"email_notifications",
|
|
|
|
"wildcard_mentions_notify",
|
|
|
|
];
|
|
|
|
|
|
|
|
exports.stream_notification_settings = [
|
|
|
|
"enable_stream_desktop_notifications",
|
|
|
|
"enable_stream_audible_notifications",
|
|
|
|
"enable_stream_push_notifications",
|
|
|
|
"enable_stream_email_notifications",
|
|
|
|
"wildcard_mentions_notify",
|
|
|
|
];
|
|
|
|
|
|
|
|
const pm_mention_notification_settings = [
|
|
|
|
"enable_desktop_notifications",
|
|
|
|
"enable_sounds",
|
|
|
|
"enable_offline_push_notifications",
|
|
|
|
"enable_offline_email_notifications",
|
|
|
|
];
|
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
const desktop_notification_settings = ["pm_content_in_desktop_notifications"];
|
2020-03-28 18:03:43 +01:00
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
const mobile_notification_settings = ["enable_online_push_notifications"];
|
2020-03-28 18:03:43 +01:00
|
|
|
|
|
|
|
const email_notification_settings = [
|
|
|
|
"enable_digest_emails",
|
|
|
|
"enable_login_emails",
|
|
|
|
"message_content_in_email_notifications",
|
|
|
|
"realm_name_in_notifications",
|
|
|
|
];
|
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
const presence_notification_settings = ["presence_enabled"];
|
2020-05-01 20:39:26 +02:00
|
|
|
|
2020-03-28 18:03:43 +01:00
|
|
|
const other_notification_settings = desktop_notification_settings.concat(
|
|
|
|
["desktop_icon_count_display"],
|
|
|
|
mobile_notification_settings,
|
|
|
|
email_notification_settings,
|
2020-05-01 20:39:26 +02:00
|
|
|
presence_notification_settings,
|
2020-07-02 02:16:03 +02:00
|
|
|
["notification_sound"],
|
2020-03-28 18:03:43 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
exports.all_notification_settings = other_notification_settings.concat(
|
|
|
|
pm_mention_notification_settings,
|
2020-07-02 02:16:03 +02:00
|
|
|
exports.stream_notification_settings,
|
2020-03-28 18:03:43 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
exports.all_notifications = () => ({
|
|
|
|
general_settings: [
|
|
|
|
{
|
|
|
|
label: i18n.t("Streams"),
|
|
|
|
notification_settings: settings_notifications.get_notifications_table_row_data(
|
2020-07-15 00:34:28 +02:00
|
|
|
exports.stream_notification_settings,
|
|
|
|
),
|
2020-03-28 18:03:43 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: i18n.t("PMs, mentions, and alerts"),
|
|
|
|
notification_settings: settings_notifications.get_notifications_table_row_data(
|
2020-07-15 00:34:28 +02:00
|
|
|
pm_mention_notification_settings,
|
|
|
|
),
|
2020-03-28 18:03:43 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
settings: {
|
2020-07-20 22:18:43 +02:00
|
|
|
desktop_notification_settings,
|
|
|
|
mobile_notification_settings,
|
|
|
|
email_notification_settings,
|
|
|
|
presence_notification_settings,
|
2020-03-28 18:03:43 +01:00
|
|
|
},
|
|
|
|
show_push_notifications_tooltip: {
|
|
|
|
push_notifications: !page_params.realm_push_notifications_enabled,
|
|
|
|
enable_online_push_notifications: !page_params.realm_push_notifications_enabled,
|
|
|
|
},
|
|
|
|
});
|