diff --git a/client/startup/unread.js b/client/startup/unread.js
index 634075c748da..258bfa418a2d 100644
--- a/client/startup/unread.js
+++ b/client/startup/unread.js
@@ -32,7 +32,7 @@ Meteor.startup(function() {
// Increment the total unread count.
unreadCount += subscription.unread;
if (subscription.alert === true && subscription.unreadAlert !== 'nothing') {
- const userUnreadAlert = Meteor.user() && Meteor.user().settings && Meteor.user().settings.preferences && Meteor.user().settings.preferences.unreadAlert;
+ const userUnreadAlert = RocketChat.getUserPreference(Meteor.user(), 'unreadAlert');
if (subscription.unreadAlert === 'all' || userUnreadAlert !== false) {
unreadAlert = '•';
}
diff --git a/packages/rocketchat-emoji-emojione/rocketchat.js b/packages/rocketchat-emoji-emojione/rocketchat.js
index 62207d31662b..48d15ba3b6eb 100644
--- a/packages/rocketchat-emoji-emojione/rocketchat.js
+++ b/packages/rocketchat-emoji-emojione/rocketchat.js
@@ -35,8 +35,8 @@ for (const key in emojione.emojioneList) {
Meteor.startup(function() {
Tracker.autorun(function() {
if (isSetNotNull(() => RocketChat.emoji.packages.emojione)) {
- if (isSetNotNull(() => Meteor.user().settings.preferences.convertAsciiEmoji)) {
- RocketChat.emoji.packages.emojione.ascii = Meteor.user().settings.preferences.convertAsciiEmoji;
+ if (isSetNotNull(() => RocketChat.getUserPreference(Meteor.user(), 'convertAsciiEmoji'))) {
+ RocketChat.emoji.packages.emojione.ascii = RocketChat.getUserPreference(Meteor.user(), 'convertAsciiEmoji');
} else {
RocketChat.emoji.packages.emojione.ascii = true;
}
diff --git a/packages/rocketchat-emoji/client/emojiParser.js b/packages/rocketchat-emoji/client/emojiParser.js
index bba9300830dd..d31b4bc77887 100644
--- a/packages/rocketchat-emoji/client/emojiParser.js
+++ b/packages/rocketchat-emoji/client/emojiParser.js
@@ -6,7 +6,8 @@ import s from 'underscore.string';
* @param {Object} message - The message object
*/
RocketChat.callbacks.add('renderMessage', (message) => {
- if (isSetNotNull(() => Meteor.user().settings.preferences.useEmojis) && !Meteor.user().settings.preferences.useEmojis) {
+ if (isSetNotNull(() => RocketChat.getUserPreference(Meteor.user(), 'useEmojis')) &&
+ !RocketChat.getUserPreference(Meteor.user(), 'useEmojis')) {
return message;
}
diff --git a/packages/rocketchat-highlight-words/client/client.js b/packages/rocketchat-highlight-words/client/client.js
index 22a897bdcc69..aa3c6dc5c32b 100644
--- a/packages/rocketchat-highlight-words/client/client.js
+++ b/packages/rocketchat-highlight-words/client/client.js
@@ -15,7 +15,7 @@ function HighlightWordsClient(message) {
}
}
- const to_highlight = Meteor.user() && Meteor.user().settings && Meteor.user().settings.preferences && Meteor.user().settings.preferences.highlights;
+ const to_highlight = RocketChat.getUserPreference(Meteor.user(), 'highlights');
if (Array.isArray(to_highlight)) {
to_highlight.forEach((highlight) => {
if (!s.isBlank(highlight)) {
diff --git a/packages/rocketchat-i18n/i18n/ca.i18n.json b/packages/rocketchat-i18n/i18n/ca.i18n.json
index 7a1afcb9737b..31af00dcee70 100644
--- a/packages/rocketchat-i18n/i18n/ca.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ca.i18n.json
@@ -40,6 +40,8 @@
"Accounts_CustomFields_Description": "Ha de ser un objecte JSON vàlid on les claus són els noms dels camps i contenen un diccionari amb les opcions del camp. Exemple:{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"student\",\n \"options\": [\"teacher\", \"student\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Camps personalitzats a mostrar a l'informació d'usuari",
"Accounts_DefaultUsernamePrefixSuggestion": "Prefix suggerit per al nom d'usuari per defecte",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Alerta per defecte per a les notificacions d'escriptori",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Alerta per defecte notificacions mòbil",
"Accounts_denyUnverifiedEmail": "Denegar correu electrònic sense verificar",
"Accounts_EmailVerification": "Verificació de correu electrònic",
"Accounts_EmailVerification_Description": "Assegura't que la configuració SMTP és correcta per fer servir aquesta funcionalitat",
@@ -478,7 +480,6 @@
"Desktop": "Escriptori",
"Desktop_Notification_Test": "Prova de notificació d'escriptori",
"Desktop_Notifications": "Notificacions d'escriptori",
- "Desktop_Notifications_Default_Alert": "Alerta per defecte per a les notificacions d'escriptori",
"Desktop_Notifications_Disabled": "Les notificacions d'escriptori han estat desactivades. Canvia les preferències del navegador si vols tornar a activar-les.",
"Desktop_Notifications_Duration": "Durada de les notificacions d'escriptori",
"Desktop_Notifications_Duration_Description": "Segons de mostra de les notificacions d'escriptori. Això pot afectar al centre de notificacions del macOS. Introduïu 0 per utilitzar la configuració del navegador per defecte i no afectar al centre de notificacions.",
@@ -1183,7 +1184,6 @@
"Min_length_is": "La llargada mínima és %s",
"minutes": "minuts",
"Mobile": "Mòbil",
- "Mobile_Notifications_Default_Alert": "Alerta per defecte notificacions mòbil",
"Monday": "dilluns",
"Monitor_history_for_changes_on": "Monitoritza l'historial per canvis a ",
"More_channels": "Més canals",
@@ -2006,4 +2006,4 @@
"your_message_optional": "el teu missatge (opcional)",
"Your_password_is_wrong": "La contrasenya és incorrecta!",
"Your_push_was_sent_to_s_devices": "La notificació push s'ha enviat a %s dispositius"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-i18n/i18n/cs.i18n.json b/packages/rocketchat-i18n/i18n/cs.i18n.json
index 9f971f8084ab..72d997305d79 100644
--- a/packages/rocketchat-i18n/i18n/cs.i18n.json
+++ b/packages/rocketchat-i18n/i18n/cs.i18n.json
@@ -40,6 +40,9 @@
"Accounts_CustomFields_Description": "Validní JSON obsahující klíče polí s nastavením. Například:{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"student\",\n \"options\": [\"teacher\", \"student\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Vlastní pole zobrazená v uživatelském profilu",
"Accounts_DefaultUsernamePrefixSuggestion": "Výchozí návrh prefixu uživatelského jména",
+ "Accounts_Default_User_Preferences_audioNotifications": "Výchozí zvuk upozornění audia",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Výchozí upozornění oznámení na ploše",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Výchozí upozornění mobilní notifikace",
"Accounts_denyUnverifiedEmail": "Zakázat neověřené e-mailové adresy",
"Accounts_EmailVerification": "Ověření e-mailu",
"Accounts_EmailVerification_Description": "Pro použití této funkce se ujistěte, že máte správné nastavení SMTP",
@@ -245,8 +248,6 @@
"Attribute_handling": "Operace s atributy",
"Audio_message": "Audio zpráva",
"Audio_Notification_Value_Description": "Jakýkoliv z výchozích zvuků: beep, chelle, ding, droplet, highbell, seasons",
- "Audio_Notifications_Default_Alert": "Výchozí zvuk upozornění audia",
- "Audio_Notifications_Value": "Výchozí zvuk upozornění zprávy",
"Auth_Token": "Auth Token",
"Author": "Autor",
"Authorization_URL": "URL autorizace",
@@ -482,7 +483,6 @@
"Desktop": "Plocha",
"Desktop_Notification_Test": "Test oznámení na ploše",
"Desktop_Notifications": "Oznámení na ploše",
- "Desktop_Notifications_Default_Alert": "Výchozí upozornění oznámení na ploše",
"Desktop_Notifications_Disabled": "Oznámení na ploše jsou vypnuta. Změňte nastavení svého prohlížeče, pokud chcete oznámení povolit.",
"Desktop_Notifications_Duration": "Délka zobrazení notifikace",
"Desktop_Notifications_Duration_Description": "Délka zobrazení oznámení (v sekundách). Toto může ovlivnit nastevení OS X Oznamovacího centra. Zadejte 0 pro použítí výchozí nastavení prohlížeče/notifikačního centra OS X",
@@ -1224,7 +1224,6 @@
"Min_length_is": "Minimální délka je %s",
"minutes": "minuty",
"Mobile": "Mobilní",
- "Mobile_Notifications_Default_Alert": "Výchozí upozornění mobilní notifikace",
"Monday": "Pondělí",
"Monitor_history_for_changes_on": "Sledovat historii na změny:",
"More_channels": "Více místností",
@@ -2058,4 +2057,4 @@
"your_message_optional": "vaše zpráva (nepovinná)",
"Your_password_is_wrong": "Vaše heslo je špatně!",
"Your_push_was_sent_to_s_devices": "Vaše notifikace byla odeslána do %s zařízení"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-i18n/i18n/de.i18n.json b/packages/rocketchat-i18n/i18n/de.i18n.json
index 47c4d9bdbe95..4f3457a0c4a0 100644
--- a/packages/rocketchat-i18n/i18n/de.i18n.json
+++ b/packages/rocketchat-i18n/i18n/de.i18n.json
@@ -41,6 +41,9 @@
"Accounts_CustomFields_Description": "Ein gültiges JSON, in dem die Schlüssel Sprachkürzel sind, die wiederum Tupel von Schlüssel und Übersetzungen enthalten. Beispiel:
\n{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"student\",\n \"options\": [\"teacher\", \"student\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Eigene Felder, die in der Benutzer-Information angezeigt werden sollen",
"Accounts_DefaultUsernamePrefixSuggestion": "Vorschlag für Präfix des Standard-Benutzernamens ",
+ "Accounts_Default_User_Preferences_audioNotifications": "Akustische Benachrichtigung bei",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Desktop-Benachrichtigungen bei",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Mobile Benachrichtigungen bei",
"Accounts_denyUnverifiedEmail": "Nicht verifizierte E-Mail-Adressen ablehnen",
"Accounts_EmailVerification": "E-Mail-Verifizierung",
"Accounts_EmailVerification_Description": "Um diese Funktion nutzen zu können, stellen Sie bitte sicher, dass ihre SMTP-Einstellungen korrekt sind.",
@@ -246,8 +249,6 @@
"Attribute_handling": "Behandlung von Eigenschaften",
"Audio_message": "Audio-Nachricht",
"Audio_Notification_Value_Description": "Dies kann einer der Standard-Töne (beep, chelle, ding, droplet, highbell, seasons) oder jeder eigene Ton sein",
- "Audio_Notifications_Default_Alert": "Akustische Benachrichtigung bei",
- "Audio_Notifications_Value": "Akustische Benachrichtigung: Ton",
"Auth_Token": "Auth-Token",
"Author": "Autor",
"Authorization_URL": "Autorisierungs-URL",
@@ -483,7 +484,6 @@
"Desktop": "Desktop",
"Desktop_Notification_Test": "Desktop-Benachrichtigungstest",
"Desktop_Notifications": "Desktop-Benachrichtigungen",
- "Desktop_Notifications_Default_Alert": "Desktop-Benachrichtigungen bei",
"Desktop_Notifications_Disabled": "Desktop-Benachrichtigungen sind deaktiviert. Ändern Sie Ihre Browsereinstellungen, wenn Sie Benachrichtigungen erhalten wollen.",
"Desktop_Notifications_Duration": "Desktop-Benachrichtigungsdauer",
"Desktop_Notifications_Duration_Description": "Zeit in Sekunden für die Desktop-Benachrichtigungen angezeigt werden sollen. Dies kann OS X Notification Center beeinflussen. Geben Sie 0 ein, um die Standard-Browser-Einstellungen zu verwenden und OS X Notification Center nicht zu beeinflussen.",
@@ -1194,7 +1194,6 @@
"Min_length_is": "Die minimale Länge beträgt %s",
"minutes": "Minuten",
"Mobile": "Mobil",
- "Mobile_Notifications_Default_Alert": "Mobile Benachrichtigungen bei",
"Monday": "Montag",
"Monitor_history_for_changes_on": "Was soll für die Historie überwacht werden?",
"More_channels": "Weitere Kanäle",
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index 59bf4aa6105a..3b9f3c2c6b1c 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -41,6 +41,10 @@
"Accounts_CustomFields_Description": "Should be a valid JSON where keys are the field names containing a dictionary of field settings. Example:{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"student\",\n \"options\": [\"teacher\", \"student\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Custom Fields to Show in User Info",
"Accounts_DefaultUsernamePrefixSuggestion": "Default Username Prefix Suggestion",
+ "Accounts_Default_User_Preferences": "Default User Preferences",
+ "Accounts_Default_User_Preferences_audioNotifications": "Audio Notifications Default Alert",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Desktop Notifications Default Alert",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Mobile Notifications Default Alert",
"Accounts_denyUnverifiedEmail": "Deny unverified email",
"Accounts_EmailVerification": "Email Verification",
"Accounts_EmailVerification_Description": "Make sure you have correct SMTP settings to use this feature",
@@ -255,8 +259,6 @@
"Attribute_handling": "Attribute handling",
"Audio_message": "Audio message",
"Audio_Notification_Value_Description": "Can be any custom sound or the default ones: beep, chelle, ding, droplet, highbell, seasons",
- "Audio_Notifications_Default_Alert": "Audio Notifications Default Alert",
- "Audio_Notifications_Value": "Default Message Notification Audio",
"Auth_Token": "Auth Token",
"Author": "Author",
"Authorization_URL": "Authorization URL",
@@ -494,7 +496,6 @@
"Desktop": "Desktop",
"Desktop_Notification_Test": "Desktop Notification Test",
"Desktop_Notifications": "Desktop Notifications",
- "Desktop_Notifications_Default_Alert": "Desktop Notifications Default Alert",
"Desktop_Notifications_Disabled": "Desktop Notifications are Disabled. Change your browser preferences if you need Notifications enabled.",
"Desktop_Notifications_Duration": "Desktop Notifications Duration",
"Desktop_Notifications_Duration_Description": "Seconds to display desktop notification. This may affect OS X Notification Center. Enter 0 to use default browser settings and not affect OS X Notification Center.",
@@ -1248,7 +1249,6 @@
"Minimum_balance": "Minimum balance",
"minutes": "minutes",
"Mobile": "Mobile",
- "Mobile_Notifications_Default_Alert": "Mobile Notifications Default Alert",
"Monday": "Monday",
"Monitor_history_for_changes_on": "Monitor History for Changes on",
"More_channels": "More channels",
diff --git a/packages/rocketchat-i18n/i18n/fr.i18n.json b/packages/rocketchat-i18n/i18n/fr.i18n.json
index 82240d73db89..01652705272d 100644
--- a/packages/rocketchat-i18n/i18n/fr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/fr.i18n.json
@@ -35,6 +35,7 @@
"Accounts_BlockedUsernameList_Description": "Liste de noms d'utilisateurs bloqués (insensible à la casse), séparés par des virgules",
"Accounts_CustomFields_Description": "Devrait être un JSON valide où les clés sont les noms des champs contenant un dictionnaire de champs de paramétrage. Exemple :
\n{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"eleve\",\n \"options\": [\"enseignant\", \"eleve\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_DefaultUsernamePrefixSuggestion": "Suggestion par défaut du préfixe du nom d'utilisateur",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Alterte notification de bureau par défaut",
"Accounts_denyUnverifiedEmail": "Refuser les e-mails non vérifiés",
"Accounts_EmailVerification": "Vérification de l'adresse e-mail",
"Accounts_EmailVerification_Description": "Vous devez avoir des paramètres SMTP corrects pour utiliser cette fonctionnalité",
@@ -415,7 +416,6 @@
"Desktop": "Bureau",
"Desktop_Notification_Test": "Test des notifications sur le bureau",
"Desktop_Notifications": "Notifications sur le bureau",
- "Desktop_Notifications_Default_Alert": "Alterte notification de bureau par défaut",
"Desktop_Notifications_Disabled": "Les notifications du bureau sont désactivées, Modifiez les préférences de votre navigateur si vous avez besoin de les activer.",
"Desktop_Notifications_Duration": "Durée des notifications",
"Desktop_Notifications_Duration_Description": "Secondes pour afficher une notification de bureau. Cela peut affecter le Centre de Notification de OS X. Entrez 0 pour utiliser les paramètres du navigateur par défaut et ne pas affecter le Centre de Notification de OS X.",
@@ -1612,4 +1612,4 @@
"your_message_optional": "votre message (optionnel)",
"Your_password_is_wrong": "Votre mot de passe est incorrect !",
"Your_push_was_sent_to_s_devices": "Votre notification a été envoyée à %s appareils"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-i18n/i18n/pl.i18n.json b/packages/rocketchat-i18n/i18n/pl.i18n.json
index 530f250a3337..6a731d8b78a1 100644
--- a/packages/rocketchat-i18n/i18n/pl.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pl.i18n.json
@@ -33,6 +33,7 @@
"Accounts_BlockedDomainsList_Description": "Oddzielonych przecinkami lista zablokowanych domen",
"Accounts_BlockedUsernameList": "Lista zablokowanych użytkowników",
"Accounts_BlockedUsernameList_Description": "Oddzielona przecinkami lista zablokowanych użytkowników (bez uwzględniania wielkości liter)",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Domyślne powiadomnienia mobilne",
"Accounts_denyUnverifiedEmail": "Odrzucaj niezweryfikowane adresy email",
"Accounts_EmailVerification": "Weryfikacja adresu email",
"Accounts_EmailVerification_Description": "Upewnij się, że masz odpowiednie ustawienia SMTP by korzystać z tej funkcji",
@@ -848,7 +849,6 @@
"Min_length_is": "Minimalna długość to %s",
"minutes": "minut",
"Mobile": "Powiadomnienia mobilne",
- "Mobile_Notifications_Default_Alert": "Domyślne powiadomnienia mobilne",
"Monday": "Poniedziałek",
"Monitor_history_for_changes_on": "Sprawdź historię zmian na",
"More_channels": "Więcej kanałów",
@@ -1434,4 +1434,4 @@
"your_message_optional": "twoja wiadomość (opcjonalnie)",
"Your_password_is_wrong": "To nie jest poprawne hasło!",
"Your_push_was_sent_to_s_devices": "Twój push została wysłany do urządzeń: %s"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
index 2b66cfc0b18e..1847d68194db 100644
--- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
@@ -33,6 +33,10 @@
"Accounts_BlockedUsernameList_Description": "Lista de nomes de usuários bloqueados, separada por vírgulas (não diferencia maiúsculas)",
"Accounts_CustomFields_Description": "Deve ser um JSON válido onde as chaves são os nomes de campos contendo um dicionário de configuração de campos. Exemplo:{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"estudante\",\n \"options\": [\"professor\", \"estudante\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Campos personalizados a exibir",
+ "Accounts_Default_User_Preferences": "Preferências Padrões do Usuário",
+ "Accounts_Default_User_Preferences_audioNotifications": "Áudio padrão para alerta de notificação",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Alerta padrão para notificações Desktop",
+ "Accounts_Default_User_Preferences_mobileNotifications": "Alerta padrão para notificações Mobile",
"Accounts_denyUnverifiedEmail": "Proibir e-mail não verificado",
"Accounts_EmailVerification": "Verificação de E-mail",
"Accounts_EmailVerification_Description": "Certifique-se de que as configurações de SMTP estão corretas para usar este recurso",
diff --git a/packages/rocketchat-i18n/i18n/ru.i18n.json b/packages/rocketchat-i18n/i18n/ru.i18n.json
index 8ff219e624f8..e53ffc4e24fa 100644
--- a/packages/rocketchat-i18n/i18n/ru.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ru.i18n.json
@@ -39,6 +39,7 @@
"Accounts_CustomFields_Description": "Ожидается валидный JSON-объект, в котором каждый ключ - это имя поля, а содержимое - словарь настроек поля. Пример:{\n \"role\": {\n \"type\": \"select\",\n \"defaultValue\": \"student\",\n \"options\": [\"teacher\", \"student\"],\n \"required\": true,\n \"modifyRecordField\": {\n \"array\": true,\n \"field\": \"roles\"\n }\n },\n \"twitter\": {\n \"type\": \"text\",\n \"required\": true,\n \"minLength\": 2,\n \"maxLength\": 10\n }\n}\n
",
"Accounts_CustomFieldsToShowInUserInfo": "Кастомные поля для отображения в информации пользователя",
"Accounts_DefaultUsernamePrefixSuggestion": "Предлагаемая подсказка префикса логина",
+ "Accounts_Default_User_Preferences_desktopNotifications": "Стандартные оповещения на рабочем столе",
"Accounts_denyUnverifiedEmail": "Запретить неподтверждённые адреса электронной почты",
"Accounts_EmailVerification": "Подтверждение адреса электронной почты",
"Accounts_EmailVerification_Description": "Убедитесь, что у вас верные настройки SMTP для использования этой функции",
@@ -442,7 +443,6 @@
"Desktop": "Рабочий стол",
"Desktop_Notification_Test": "Проверка уведомлений рабочего стола",
"Desktop_Notifications": "Оповещения на рабочем столе",
- "Desktop_Notifications_Default_Alert": "Стандартные оповещения на рабочем столе",
"Desktop_Notifications_Disabled": "Оповещения отключены. Измените настройки браузера, чтобы включить уведомления.",
"Desktop_Notifications_Duration": "Длительность",
"Desktop_Notifications_Duration_Description": "Секунды для отображения уведомлений на рабочем столе. Это может повлиять на OS X Центр уведомлений. Введите 0, чтобы использовать настройки браузера по умолчанию и не влиять на OS X Центр уведомлений.",
@@ -1731,4 +1731,4 @@
"your_message_optional": "Сообщение (опционально)",
"Your_password_is_wrong": "Неверный пароль!",
"Your_push_was_sent_to_s_devices": "Оповещение было отправлено на % устройств."
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-i18n/i18n/tr.i18n.json b/packages/rocketchat-i18n/i18n/tr.i18n.json
index 0761806e0886..5f0d6a8536ba 100644
--- a/packages/rocketchat-i18n/i18n/tr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/tr.i18n.json
@@ -40,6 +40,7 @@
"Accounts_CustomFields_Description": "Anahtarların, alan ayarları sözlüğü bulunduran alan isimleri olduğu geçerli bir JSON olmalı. Örnek:{\n\n \"role\": {\n\n \"type\": \"select\",\n\n \"defaultValue\": \"student\",\n\n \"options\": [\"teacher\", \"student\"],\n\n \"required\": true,\n\n \"modifyRecordField\": {\n\n \"array\": true,\n\n \"field\": \"roles\"\n\n }\n\n },\n\n \"twitter\": {\n\n \"type\": \"text\",\n\n \"required\": true,\n\n \"minLength\": 2,\n\n \"maxLength\": 10\n\n }\n\n}
",
"Accounts_CustomFieldsToShowInUserInfo": "Kullanıcı Bilgilerini Göstermek için Özel alanlar",
"Accounts_DefaultUsernamePrefixSuggestion": "Varsayılan kullanıcı adı ön eki tavsiyesi",
+ "Accounts_Default_User_Preferences_audioNotifications": "Sesli Mesaj için Varsayılan Uyarı",
"Accounts_denyUnverifiedEmail": "Doğrulanmamış e-posta'yı reddet",
"Accounts_EmailVerification": "E-Posta Doğrulama",
"Accounts_EmailVerification_Description": "Bu özelliği kullanmak için doğru SMTP ayarlarına sahip olduğunuza emin olun",
@@ -220,8 +221,6 @@
"AtlassianCrowd": "Atlassian Crowd",
"Attachment_File_Uploaded": "Dosya Yüklendi",
"Audio_message": "Sesli Mesaj",
- "Audio_Notifications_Default_Alert": "Sesli Mesaj için Varsayılan Uyarı",
- "Audio_Notifications_Value": "Varsayılan mesaj bildirim sesi",
"Auth_Token": "Kimlik Doğrulama Jetonu",
"Author": "Yazar",
"Authorization_URL": "yetkilendirme URL'si",
@@ -1304,4 +1303,4 @@
"Your_mail_was_sent_to_s": "Posta %s gönderildi",
"Your_password_is_wrong": "Parolanız yanlış!",
"Your_push_was_sent_to_s_devices": "Sizin itme %s cihazlara gönderildi"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-lib/lib/getUserPreference.js b/packages/rocketchat-lib/lib/getUserPreference.js
new file mode 100644
index 000000000000..1d516996784d
--- /dev/null
+++ b/packages/rocketchat-lib/lib/getUserPreference.js
@@ -0,0 +1,16 @@
+/**
+ * Tries to retrieve the user preference falling back to a default system
+ * value or to a default value if it is passed as argument
+*/
+RocketChat.getUserPreference = function(user, key, defaultValue=undefined) {
+ let preference;
+
+ if (user && user.settings && user.settings.preferences &&
+ user.settings.preferences.hasOwnProperty(key)) {
+ preference = user.settings.preferences[key];
+ } else if (defaultValue === undefined) {
+ preference = RocketChat.settings.get(`Accounts_Default_User_Preferences_${ key }`);
+ }
+
+ return preference !== undefined ? preference : defaultValue;
+};
diff --git a/packages/rocketchat-lib/lib/roomTypes/channels.js b/packages/rocketchat-lib/lib/roomTypes/channels.js
index cd39eeeb37bc..4d0fbcc1a837 100644
--- a/packages/rocketchat-lib/lib/roomTypes/channels.js
+++ b/packages/rocketchat-lib/lib/roomTypes/channels.js
@@ -11,7 +11,8 @@ export class ChannelsRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
- return ['unread', 'category'].includes(preferences.roomsListExhibitionMode) && preferences.mergeChannels;
+ const roomsListExhibitionMode = RocketChat.getUserPreference(user, 'roomsListExhibitionMode');
+ const mergeChannels = RocketChat.getUserPreference(user, 'mergeChannels');
+ return ['unread', 'category'].includes(roomsListExhibitionMode) && mergeChannels;
}
}
diff --git a/packages/rocketchat-lib/lib/roomTypes/conversation.js b/packages/rocketchat-lib/lib/roomTypes/conversation.js
index 1aaa9faa2374..009dbf59ccbf 100644
--- a/packages/rocketchat-lib/lib/roomTypes/conversation.js
+++ b/packages/rocketchat-lib/lib/roomTypes/conversation.js
@@ -11,7 +11,6 @@ export class ConversationRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
- return preferences.roomsListExhibitionMode === 'activity';
+ return RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'activity';
}
}
diff --git a/packages/rocketchat-lib/lib/roomTypes/direct.js b/packages/rocketchat-lib/lib/roomTypes/direct.js
index c98a3f4b3aae..9a2899615144 100644
--- a/packages/rocketchat-lib/lib/roomTypes/direct.js
+++ b/packages/rocketchat-lib/lib/roomTypes/direct.js
@@ -62,9 +62,8 @@ export class DirectMessageRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
-
- return !preferences.roomsListExhibitionMode || ['unread', 'category'].includes(preferences.roomsListExhibitionMode) && RocketChat.authz.hasAtLeastOnePermission(['view-d-room', 'view-joined-room']);
+ const roomsListExhibitionMode = RocketChat.getUserPreference(user, 'roomsListExhibitionMode');
+ return !roomsListExhibitionMode || ['unread', 'category'].includes(roomsListExhibitionMode) && RocketChat.authz.hasAtLeastOnePermission(['view-d-room', 'view-joined-room']);
}
getUserStatus(roomId) {
diff --git a/packages/rocketchat-lib/lib/roomTypes/private.js b/packages/rocketchat-lib/lib/roomTypes/private.js
index cc01d86fe93c..c0a3fdbfe2f4 100644
--- a/packages/rocketchat-lib/lib/roomTypes/private.js
+++ b/packages/rocketchat-lib/lib/roomTypes/private.js
@@ -44,9 +44,9 @@ export class PrivateRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
-
- return !preferences.roomsListExhibitionMode || ['unread', 'category'].includes(preferences.roomsListExhibitionMode) && !preferences.mergeChannels && RocketChat.authz.hasAllPermission('view-p-room');
+ const roomsListExhibitionMode = RocketChat.getUserPreference(user, 'roomsListExhibitionMode');
+ const mergeChannels = RocketChat.getUserPreference(user, 'mergeChannels');
+ return !roomsListExhibitionMode || ['unread', 'category'].includes(roomsListExhibitionMode) && !mergeChannels && RocketChat.authz.hasAllPermission('view-p-room');
}
isGroupChat() {
diff --git a/packages/rocketchat-lib/lib/roomTypes/public.js b/packages/rocketchat-lib/lib/roomTypes/public.js
index 7d6425230bbc..442423364c9d 100644
--- a/packages/rocketchat-lib/lib/roomTypes/public.js
+++ b/packages/rocketchat-lib/lib/roomTypes/public.js
@@ -42,8 +42,9 @@ export class PublicRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
- return !preferences.roomsListExhibitionMode || ['unread', 'category'].includes(preferences.roomsListExhibitionMode) && !preferences.mergeChannels && (RocketChat.authz.hasAtLeastOnePermission(['view-c-room', 'view-joined-room']) || RocketChat.settings.get('Accounts_AllowAnonymousRead') === true);
+ const roomsListExhibitionMode = RocketChat.getUserPreference(user, 'roomsListExhibitionMode');
+ const mergeChannels = RocketChat.getUserPreference(user, 'mergeChannels');
+ return !roomsListExhibitionMode || ['unread', 'category'].includes(roomsListExhibitionMode) && !mergeChannels && (RocketChat.authz.hasAtLeastOnePermission(['view-c-room', 'view-joined-room']) || RocketChat.settings.get('Accounts_AllowAnonymousRead') === true);
}
showJoinLink(roomId) {
diff --git a/packages/rocketchat-lib/lib/roomTypes/unread.js b/packages/rocketchat-lib/lib/roomTypes/unread.js
index 670f71b47a36..395036c65088 100644
--- a/packages/rocketchat-lib/lib/roomTypes/unread.js
+++ b/packages/rocketchat-lib/lib/roomTypes/unread.js
@@ -13,7 +13,6 @@ export class UnreadRoomType extends RoomTypeConfig {
condition() {
const user = Meteor.user();
- const preferences = (user && user.settings && user.settings.preferences && user.settings.preferences) || {};
- return preferences.roomsListExhibitionMode === 'unread';
+ return RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'unread';
}
}
diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js
index d2b08da20d9b..c91957d52a82 100644
--- a/packages/rocketchat-lib/package.js
+++ b/packages/rocketchat-lib/package.js
@@ -78,6 +78,8 @@ Package.onUse(function(api) {
api.addFiles('lib/MessageTypes.js');
api.addFiles('lib/templateVarHandler.js');
+ api.addFiles('lib/getUserPreference.js');
+
api.addFiles('server/lib/bugsnag.js', 'server');
api.addFiles('server/lib/metrics.js', 'server');
diff --git a/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js b/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js
index 6bb2b6a89820..b7f97dba1aac 100644
--- a/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js
+++ b/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js
@@ -63,7 +63,8 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
}
highlights.forEach(function(user) {
- if (user && user.settings && user.settings.preferences && messageContainsHighlight(message, user.settings.preferences.highlights)) {
+ const userHighlights = RocketChat.getUserPreference(user, 'highlights');
+ if (userHighlights && messageContainsHighlight(message, userHighlights)) {
if (user._id !== message.u._id) {
highlightsIds.push(user._id);
}
diff --git a/packages/rocketchat-lib/server/lib/sendEmailOnMessage.js b/packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
index 79e2e110d2b6..779b1c57b888 100644
--- a/packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
+++ b/packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
@@ -167,8 +167,9 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (usersOfMention && usersOfMention.length > 0) {
usersOfMention.forEach((user) => {
+ const emailNotificationMode = RocketChat.getUserPreference(user, 'emailNotificationMode');
if (usersToSendEmail[user._id] === 'default') {
- if (!user.settings || !user.settings.preferences || !user.settings.preferences.emailNotificationMode || user.settings.preferences.emailNotificationMode === 'all') { //Mention/DM
+ if (emailNotificationMode === 'all') { //Mention/DM
usersToSendEmail[user._id] = 'mention';
} else {
return;
@@ -176,7 +177,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
}
if (usersToSendEmail[user._id] === 'direct') {
- const userEmailPreferenceIsDisabled = user.settings && user.settings.preferences && user.settings.preferences.emailNotificationMode && (user.settings.preferences.emailNotificationMode === 'disabled');
+ const userEmailPreferenceIsDisabled = emailNotificationMode === 'disabled';
const directMessageEmailPreference = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(message.rid, message.rid.replace(message.u._id, '')).emailNotifications;
if (directMessageEmailPreference === 'nothing') {
diff --git a/packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js b/packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js
index 70e6dda5eb85..401491bbec6e 100644
--- a/packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js
+++ b/packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js
@@ -206,9 +206,9 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room, userId) {
subscriptions.forEach((s) => {
userIds.push(s.u._id);
});
- const userSettings = {};
- RocketChat.models.Users.findUsersByIds(userIds, { fields: { 'settings.preferences.audioNotifications': 1, 'settings.preferences.desktopNotifications': 1, 'settings.preferences.mobileNotifications': 1 } }).forEach((user) => {
- userSettings[user._id] = user.settings;
+ const users = {};
+ RocketChat.models.Users.findUsersByIds(userIds, { fields: { 'settings.preferences': 1 } }).forEach((user) => {
+ users[user._id] = user;
});
subscriptions.forEach(subscription => {
@@ -218,16 +218,13 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room, userId) {
settings.dontNotifyAudioUsers.push(subscription.u._id);
return;
}
- const preferences = userSettings[subscription.u._id] ? userSettings[subscription.u._id].preferences || {} : {};
- const userAudioNotificationPreference = preferences.audioNotifications !== 'default' ? preferences.audioNotifications : undefined;
- const userDesktopNotificationPreference = preferences.desktopNotifications !== 'default' ? preferences.desktopNotifications : undefined;
- const userMobileNotificationPreference = preferences.mobileNotifications !== 'default' ? preferences.mobileNotifications : undefined;
- // Set defaults if they don't exist
+
const {
- audioNotifications = userAudioNotificationPreference || RocketChat.settings.get('Audio_Notifications_Default_Alert'),
- desktopNotifications = userDesktopNotificationPreference || RocketChat.settings.get('Desktop_Notifications_Default_Alert'),
- mobilePushNotifications = userMobileNotificationPreference || RocketChat.settings.get('Mobile_Notifications_Default_Alert')
+ audioNotifications = RocketChat.getUserPreference(users[subscription.u._id], 'audioNotifications'),
+ desktopNotifications = RocketChat.getUserPreference(users[subscription.u._id], 'desktopNotifications'),
+ mobilePushNotifications = RocketChat.getUserPreference(users[subscription.u._id], 'mobileNotifications')
} = subscription;
+
if (audioNotifications === 'all' && !disableAllMessageNotifications) {
settings.alwaysNotifyAudioUsers.push(subscription.u._id);
}
diff --git a/packages/rocketchat-lib/server/startup/settings.js b/packages/rocketchat-lib/server/startup/settings.js
index 5e25d29ac04b..dab6f94bcdf4 100644
--- a/packages/rocketchat-lib/server/startup/settings.js
+++ b/packages/rocketchat-lib/server/startup/settings.js
@@ -170,6 +170,245 @@ RocketChat.settings.addGroup('Accounts', function() {
});
});
+ this.section('Accounts_Default_User_Preferences', function() {
+ this.add('Accounts_Default_User_Preferences_enableAutoAway', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Enable_Auto_Away'
+ });
+ this.add('Accounts_Default_User_Preferences_idleTimeoutLimit', 300000, {
+ type: 'int',
+ 'public': true,
+ i18nLabel: 'Idle_Time_Limit'
+ });
+ this.add('Accounts_Default_User_Preferences_desktopNotificationDuration', 0, {
+ type: 'int',
+ 'public': true,
+ i18nLabel: 'Notification_Duration'
+ });
+ this.add('Accounts_Default_User_Preferences_audioNotifications', 'mentions', {
+ type: 'select',
+ values: [
+ {
+ key: 'all',
+ i18nLabel: 'All_messages'
+ },
+ {
+ key: 'mentions',
+ i18nLabel: 'Mentions'
+ },
+ {
+ key: 'nothing',
+ i18nLabel: 'Nothing'
+ }
+ ],
+ public: true
+ });
+ this.add('Accounts_Default_User_Preferences_desktopNotifications', 'mentions', {
+ type: 'select',
+ values: [
+ {
+ key: 'all',
+ i18nLabel: 'All_messages'
+ },
+ {
+ key: 'mentions',
+ i18nLabel: 'Mentions'
+ },
+ {
+ key: 'nothing',
+ i18nLabel: 'Nothing'
+ }
+ ],
+ 'public': true
+ });
+ this.add('Accounts_Default_User_Preferences_mobileNotifications', 'mentions', {
+ type: 'select',
+ values: [
+ {
+ key : 'all',
+ i18nLabel : 'All_messages'
+ },
+ {
+ key : 'mentions',
+ i18nLabel : 'Mentions'
+ },
+ {
+ key : 'nothing',
+ i18nLabel : 'Nothing'
+ }
+ ],
+ 'public': true
+ });
+ this.add('Accounts_Default_User_Preferences_unreadAlert', true, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Unread_Tray_Icon_Alert'
+ });
+ this.add('Accounts_Default_User_Preferences_useEmojis', true, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Use_Emojis'
+ });
+ this.add('Accounts_Default_User_Preferences_convertAsciiEmoji', true, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Convert_Ascii_Emojis'
+ });
+ this.add('Accounts_Default_User_Preferences_autoImageLoad', true, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Auto_Load_Images'
+ });
+ this.add('Accounts_Default_User_Preferences_saveMobileBandwidth', true, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Save_Mobile_Bandwidth'
+ });
+ this.add('Accounts_Default_User_Preferences_collapseMediaByDefault', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Collapse_Embedded_Media_By_Default'
+ });
+ this.add('Accounts_Default_User_Preferences_hideUsernames', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Hide_usernames'
+ });
+ this.add('Accounts_Default_User_Preferences_hideRoles', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Hide_roles'
+ });
+ this.add('Accounts_Default_User_Preferences_hideFlexTab', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Hide_flextab'
+ });
+ this.add('Accounts_Default_User_Preferences_hideAvatars', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Hide_Avatars'
+ });
+ this.add('Accounts_Default_User_Preferences_roomsListExhibitionMode', 'category', {
+ type: 'select',
+ values: [
+ {
+ key: 'unread',
+ i18nLabel: 'Unread_Rooms_Mode'
+ },
+ {
+ key: 'activity',
+ i18nLabel: 'Sort_by_activity'
+ },
+ {
+ key: 'category',
+ i18nLabel: 'Split_by_categories'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'Sidebar_list_mode'
+ });
+ this.add('Accounts_Default_User_Preferences_mergeChannels', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'UI_Merge_Channels_Groups'
+ });
+ this.add('Accounts_Default_User_Preferences_sendOnEnter', 'normal', {
+ type: 'select',
+ values: [
+ {
+ key: 'normal',
+ i18nLabel: 'Enter_Normal'
+ },
+ {
+ key: 'alternative',
+ i18nLabel: 'Enter_Alternative'
+ },
+ {
+ key: 'desktop',
+ i18nLabel: 'Only_On_Desktop'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'Enter_Behaviour'
+ });
+ this.add('Accounts_Default_User_Preferences_viewMode', 0, {
+ type: 'select',
+ values: [
+ {
+ key: 0,
+ i18nLabel: 'Normal'
+ },
+ {
+ key: 1,
+ i18nLabel: 'Cozy'
+ },
+ {
+ key: 2,
+ i18nLabel: 'Compact'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'View_mode'
+ });
+ this.add('Accounts_Default_User_Preferences_emailNotificationMode', 'all', {
+ type: 'select',
+ values: [
+ {
+ key: 'disabled',
+ i18nLabel: 'Email_Notification_Mode_Disabled'
+ },
+ {
+ key: 'all',
+ i18nLabel: 'Email_Notification_Mode_All'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'Email_Notification_Mode'
+ });
+ this.add('Accounts_Default_User_Preferences_roomCounterSidebar', false, {
+ type: 'boolean',
+ 'public': true,
+ i18nLabel: 'Show_room_counter_on_sidebar'
+ });
+ this.add('Accounts_Default_User_Preferences_newRoomNotification', 'door', {
+ type: 'select',
+ values: [
+ {
+ key: 'none',
+ i18nLabel: 'None'
+ },
+ {
+ key: 'door',
+ i18nLabel: 'Default'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'New_Room_Notification'
+ });
+ this.add('Accounts_Default_User_Preferences_newMessageNotification', 'chime', {
+ type: 'select',
+ values: [
+ {
+ key: 'none',
+ i18nLabel: 'None'
+ },
+ {
+ key: 'chime',
+ i18nLabel: 'Default'
+ }
+ ],
+ 'public': true,
+ i18nLabel: 'New_Message_Notification'
+ });
+ this.add('Accounts_Default_User_Preferences_notificationsSoundVolume', 100, {
+ type: 'int',
+ 'public': true,
+ i18nLabel: 'Notifications_Sound_Volume'
+ });
+ });
+
this.section('Avatar', function() {
this.add('Accounts_AvatarResize', true, {
type: 'boolean'
@@ -448,63 +687,6 @@ RocketChat.settings.addGroup('General', function() {
});
});
this.section('Notifications', function() {
- this.add('Desktop_Notifications_Duration', 0, {
- type: 'int',
- 'public': true,
- i18nDescription: 'Desktop_Notification_Durations_Description'
- });
-
- this.add('Audio_Notifications_Value', 'chime', {
- type: 'string',
- 'public': true,
- i18nDescription: 'Audio_Notification_Value_Description'
- });
-
- this.add('Audio_Notifications_Default_Alert', 'mentions', {
- type: 'select',
- values: [{
- key: 'all',
- i18nLabel: 'All_messages'
- }, {
- key: 'mentions',
- i18nLabel: 'Mentions'
- }, {
- key: 'nothing',
- i18nLabel: 'Nothing'
- }],
- public: true
- });
-
- this.add('Desktop_Notifications_Default_Alert', 'mentions', {
- type: 'select',
- values: [{
- key: 'all',
- i18nLabel: 'All_messages'
- }, {
- key: 'mentions',
- i18nLabel: 'Mentions'
- }, {
- key: 'nothing',
- i18nLabel: 'Nothing'
- }],
- public: true
- });
-
- this.add('Mobile_Notifications_Default_Alert', 'mentions', {
- type: 'select',
- values: [{
- key: 'all',
- i18nLabel: 'All_messages'
- }, {
- key: 'mentions',
- i18nLabel: 'Mentions'
- }, {
- key: 'nothing',
- i18nLabel: 'Nothing'
- }],
- public: true
- });
-
this.add('Notifications_Max_Room_Members', 100, {
type: 'int',
public: true,
diff --git a/packages/rocketchat-livechat/app/client/lib/_visitor.js b/packages/rocketchat-livechat/app/client/lib/_visitor.js
index 4439cd99953e..290ddf92b45a 100644
--- a/packages/rocketchat-livechat/app/client/lib/_visitor.js
+++ b/packages/rocketchat-livechat/app/client/lib/_visitor.js
@@ -58,7 +58,7 @@ this.visitor = new class {
// notification sound
if (Session.equals('sound', true) && msg.u._id !== Meteor.userId()) {
- const audioVolume = Meteor.user() && Meteor.user().settings && Meteor.user().settings.preferences && Meteor.user().settings.preferences.notificationsSoundVolume || 100;
+ const audioVolume = RocketChat.getUserPreference(Meteor.user(), 'notificationsSoundVolume');
const audio = document.getElementById('chatAudioNotification');
audio.volume = Number((audioVolume/100).toPrecision(2));
audio.play();
diff --git a/packages/rocketchat-livechat/client/views/sideNav/livechat.js b/packages/rocketchat-livechat/client/views/sideNav/livechat.js
index 79497acf3773..83252463a477 100644
--- a/packages/rocketchat-livechat/client/views/sideNav/livechat.js
+++ b/packages/rocketchat-livechat/client/views/sideNav/livechat.js
@@ -22,10 +22,10 @@ Template.livechat.helpers({
};
const user = RocketChat.models.Users.findOne(Meteor.userId(), {
- fields: { 'settings.preferences.unreadRoomsMode': 1 }
+ fields: { 'settings.preferences.roomsListExhibitionMode': 1 }
});
- if (user && user.settings && user.settings.preferences && user.settings.preferences.unreadRoomsMode) {
+ if (RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'unread') {
query.alert = { $ne: true };
}
diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.js b/packages/rocketchat-message-attachments/client/messageAttachment.js
index c4d641427b76..8da6606bca34 100644
--- a/packages/rocketchat-message-attachments/client/messageAttachment.js
+++ b/packages/rocketchat-message-attachments/client/messageAttachment.js
@@ -35,11 +35,11 @@ Template.messageAttachment.helpers({
},
loadImage() {
const user = Meteor.user();
- if (user && user.settings && user.settings.preferences && this.downloadImages !== true) {
- if (user.settings.preferences.autoImageLoad === false) {
+ if (this.downloadImages !== true) {
+ if (RocketChat.getUserPreference(user, 'autoImageLoad') === false) {
return false;
}
- if (Meteor.Device.isPhone() && user.settings.preferences.saveMobileBandwidth !== true) {
+ if (Meteor.Device.isPhone() && RocketChat.getUserPreference(user, 'saveMobileBandwidth') !== true) {
return false;
}
}
@@ -56,7 +56,7 @@ Template.messageAttachment.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
},
time() {
diff --git a/packages/rocketchat-oembed/client/oembedAudioWidget.js b/packages/rocketchat-oembed/client/oembedAudioWidget.js
index 23bc9a4d7c12..5c47bcef006f 100644
--- a/packages/rocketchat-oembed/client/oembedAudioWidget.js
+++ b/packages/rocketchat-oembed/client/oembedAudioWidget.js
@@ -4,7 +4,7 @@ Template.oembedAudioWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
});
diff --git a/packages/rocketchat-oembed/client/oembedFrameWidget.js b/packages/rocketchat-oembed/client/oembedFrameWidget.js
index e47f62edca66..8ef60bc08d14 100644
--- a/packages/rocketchat-oembed/client/oembedFrameWidget.js
+++ b/packages/rocketchat-oembed/client/oembedFrameWidget.js
@@ -4,7 +4,7 @@ Template.oembedFrameWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
});
diff --git a/packages/rocketchat-oembed/client/oembedImageWidget.js b/packages/rocketchat-oembed/client/oembedImageWidget.js
index 82c71ae1f415..e62ce218b77b 100644
--- a/packages/rocketchat-oembed/client/oembedImageWidget.js
+++ b/packages/rocketchat-oembed/client/oembedImageWidget.js
@@ -2,10 +2,10 @@ Template.oembedImageWidget.helpers({
loadImage() {
const user = Meteor.user();
- if (user && user.settings && user.settings.preferences && user.settings.preferences.autoImageLoad === false && this.downloadImages == null) {
+ if (RocketChat.getUserPreference(user, 'autoImageLoad') === false && this.downloadImages == null) {
return false;
}
- if (Meteor.Device.isPhone() && user && user.settings && user.settings.preferences && user.settings.preferences.saveMobileBandwidth && this.downloadImages == null) {
+ if (Meteor.Device.isPhone() && RocketChat.getUserPreference(user, 'saveMobileBandwidth') && this.downloadImages == null) {
return false;
}
return true;
@@ -15,7 +15,7 @@ Template.oembedImageWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
});
diff --git a/packages/rocketchat-oembed/client/oembedUrlWidget.js b/packages/rocketchat-oembed/client/oembedUrlWidget.js
index 1b58f8f9e008..dc8378ee39da 100644
--- a/packages/rocketchat-oembed/client/oembedUrlWidget.js
+++ b/packages/rocketchat-oembed/client/oembedUrlWidget.js
@@ -63,7 +63,7 @@ Template.oembedUrlWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
});
diff --git a/packages/rocketchat-oembed/client/oembedVideoWidget.js b/packages/rocketchat-oembed/client/oembedVideoWidget.js
index a825ab5c976b..7a987fa084b4 100644
--- a/packages/rocketchat-oembed/client/oembedVideoWidget.js
+++ b/packages/rocketchat-oembed/client/oembedVideoWidget.js
@@ -28,7 +28,7 @@ Template.oembedVideoWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
diff --git a/packages/rocketchat-oembed/client/oembedYoutubeWidget.js b/packages/rocketchat-oembed/client/oembedYoutubeWidget.js
index 0e2ce33d4e49..5bda6ad5fcd9 100644
--- a/packages/rocketchat-oembed/client/oembedYoutubeWidget.js
+++ b/packages/rocketchat-oembed/client/oembedYoutubeWidget.js
@@ -4,7 +4,7 @@ Template.oembedYoutubeWidget.helpers({
return this.collapsed;
} else {
const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences.collapseMediaByDefault === true;
+ return RocketChat.getUserPreference(user, 'collapseMediaByDefault') === true;
}
}
});
diff --git a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js
index ca1cbccef86b..19ab56debedf 100644
--- a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js
+++ b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js
@@ -7,11 +7,6 @@ const notificationLabels = {
nothing: 'Nothing'
};
-function getUserPreference(preference) {
- const user = Meteor.user();
- return user && user.settings && user.settings.preferences && user.settings.preferences[preference];
-}
-
Template.pushNotificationsFlexTab.helpers({
audioAssets() {
return RocketChat.CustomSounds && RocketChat.CustomSounds.getList && RocketChat.CustomSounds.getList() || [];
@@ -173,23 +168,23 @@ Template.pushNotificationsFlexTab.helpers({
return Meteor.user().emails && Meteor.user().emails[0] && Meteor.user().emails[0].verified;
},
defaultAudioNotification() {
- let preference = getUserPreference('audioNotifications');
- if (preference === 'default' || preference == null) {
- preference = RocketChat.settings.get('Audio_Notifications_Default_Alert');
+ let preference = RocketChat.getUserPreference(Meteor.user(), 'audioNotifications');
+ if (preference === 'default') {
+ preference = RocketChat.settings.get('Accounts_Default_User_Preferences_audioNotifications');
}
return notificationLabels[preference];
},
defaultDesktopNotification() {
- let preference = getUserPreference('desktopNotifications');
- if (preference === 'default' || preference == null) {
- preference = RocketChat.settings.get('Desktop_Notifications_Default_Alert');
+ let preference = RocketChat.getUserPreference(Meteor.user(), 'desktopNotifications');
+ if (preference === 'default') {
+ preference = RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotifications');
}
return notificationLabels[preference];
},
defaultMobileNotification() {
- let preference = getUserPreference('mobileNotifications');
- if (preference === 'default' || preference == null) {
- preference = RocketChat.settings.get('Mobile_Notifications_Default_Alert');
+ let preference = RocketChat.getUserPreference(Meteor.user(), 'mobileNotifications');
+ if (preference === 'default') {
+ preference = RocketChat.settings.get('Accounts_Default_User_Preferences_mobileNotifications');
}
return notificationLabels[preference];
}
@@ -283,11 +278,11 @@ Template.pushNotificationsFlexTab.events({
const user = Meteor.user();
if (audio === 'Use account preference' || audio === 'none') {
- audio = user && user.settings && user.settings.preferences && user.settings.preferences.newMessageNotification || 'chime';
+ audio = RocketChat.getUserPreference(user, 'newMessageNotification');
}
if (audio && audio !== 'none') {
- const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
+ const audioVolume = RocketChat.getUserPreference(user, 'notificationsSoundVolume');
const $audio = $(`audio#${ audio }`);
if ($audio && $audio[0] && $audio[0].play) {
@@ -304,10 +299,10 @@ Template.pushNotificationsFlexTab.events({
const user = Meteor.user();
if (audio==='') {
- audio = user && user.settings && user.settings.preferences && user.settings.preferences.newMessageNotification || 'chime';
+ audio = RocketChat.getUserPreference(user, 'newMessageNotification');
}
if (audio && audio !== 'none') {
- const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
+ const audioVolume = RocketChat.getUserPreference(user, 'notificationsSoundVolume');
const $audio = $(`audio#${ audio }`);
if ($audio && $audio[0] && $audio[0].play) {
diff --git a/packages/rocketchat-ui-account/client/accountPreferences.html b/packages/rocketchat-ui-account/client/accountPreferences.html
index faf442a3fa91..17b6bcf090d6 100644
--- a/packages/rocketchat-ui-account/client/accountPreferences.html
+++ b/packages/rocketchat-ui-account/client/accountPreferences.html
@@ -30,7 +30,7 @@