[NEW] Implements user's preferences helper function

- The function returns one of three values:
  1 - The user's preference (user.settings.preferences.<preference>)
  2 - The default system setting value (Default_User_Preferences_<preference>)
  3 - A default value passed as argument to the function

- Besides the introduction of the helper function:
  - Removes unused preferences (user.settings.preferences.unreadRoomsMode, user.settings.preferences.audioNotificationValue) and creates migration script (v105)
  - Implements some simple tests
pull/7285/head
Bruno Godoy M Correa 9 years ago committed by Bruno G M Correa
parent 4d46831543
commit c7dcc51915
  1. 2
      client/startup/unread.js
  2. 4
      packages/rocketchat-emoji-emojione/rocketchat.js
  3. 3
      packages/rocketchat-emoji/client/emojiParser.js
  4. 2
      packages/rocketchat-highlight-words/client/client.js
  5. 6
      packages/rocketchat-i18n/i18n/ca.i18n.json
  6. 9
      packages/rocketchat-i18n/i18n/cs.i18n.json
  7. 7
      packages/rocketchat-i18n/i18n/de.i18n.json
  8. 8
      packages/rocketchat-i18n/i18n/en.i18n.json
  9. 4
      packages/rocketchat-i18n/i18n/fr.i18n.json
  10. 4
      packages/rocketchat-i18n/i18n/pl.i18n.json
  11. 4
      packages/rocketchat-i18n/i18n/pt-BR.i18n.json
  12. 4
      packages/rocketchat-i18n/i18n/ru.i18n.json
  13. 5
      packages/rocketchat-i18n/i18n/tr.i18n.json
  14. 16
      packages/rocketchat-lib/lib/getUserPreference.js
  15. 5
      packages/rocketchat-lib/lib/roomTypes/channels.js
  16. 3
      packages/rocketchat-lib/lib/roomTypes/conversation.js
  17. 5
      packages/rocketchat-lib/lib/roomTypes/direct.js
  18. 6
      packages/rocketchat-lib/lib/roomTypes/private.js
  19. 5
      packages/rocketchat-lib/lib/roomTypes/public.js
  20. 3
      packages/rocketchat-lib/lib/roomTypes/unread.js
  21. 2
      packages/rocketchat-lib/package.js
  22. 3
      packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js
  23. 5
      packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
  24. 19
      packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js
  25. 296
      packages/rocketchat-lib/server/startup/settings.js
  26. 2
      packages/rocketchat-livechat/app/client/lib/_visitor.js
  27. 4
      packages/rocketchat-livechat/client/views/sideNav/livechat.js
  28. 8
      packages/rocketchat-message-attachments/client/messageAttachment.js
  29. 2
      packages/rocketchat-oembed/client/oembedAudioWidget.js
  30. 2
      packages/rocketchat-oembed/client/oembedFrameWidget.js
  31. 6
      packages/rocketchat-oembed/client/oembedImageWidget.js
  32. 2
      packages/rocketchat-oembed/client/oembedUrlWidget.js
  33. 2
      packages/rocketchat-oembed/client/oembedVideoWidget.js
  34. 2
      packages/rocketchat-oembed/client/oembedYoutubeWidget.js
  35. 31
      packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js
  36. 60
      packages/rocketchat-ui-account/client/accountPreferences.html
  37. 93
      packages/rocketchat-ui-account/client/accountPreferences.js
  38. 4
      packages/rocketchat-ui-master/client/main.js
  39. 3
      packages/rocketchat-ui-message/client/message.js
  40. 6
      packages/rocketchat-ui-sidenav/client/roomList.js
  41. 8
      packages/rocketchat-ui-sidenav/client/sideNav.js
  42. 2
      packages/rocketchat-ui/client/lib/chatMessages.js
  43. 11
      packages/rocketchat-ui/client/lib/notification.js
  44. 8
      packages/rocketchat-ui/client/views/app/room.js
  45. 2
      server/methods/channelsList.js
  46. 16
      server/methods/saveUserPreferences.js
  47. 31
      server/startup/migrations/v105.js
  48. 254
      tests/end-to-end/ui/11-admin.js
  49. 97
      tests/pageobjects/administration.page.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 = '•';
}

@ -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;
}

@ -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;
}

@ -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)) {

@ -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:<br/><code>{\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}</code> ",
"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"
}
}

@ -40,6 +40,9 @@
"Accounts_CustomFields_Description": "Validní JSON obsahující klíče polí s nastavením. Například:<br/><code>{\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}</code>",
"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í"
}
}

@ -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: <br/>\n<code>{\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}</code>",
"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",

@ -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:<br/><code>{\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}</code> ",
"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",

@ -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 :<br/>\n<code>{\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}</code> ",
"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"
}
}

@ -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"
}
}

@ -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:<br/><code>{\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}</code> ",
"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",

@ -39,6 +39,7 @@
"Accounts_CustomFields_Description": "Ожидается валидный JSON-объект, в котором каждый ключ - это имя поля, а содержимое - словарь настроек поля. Пример:<br/><code>{\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</code>",
"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": "Оповещение было отправлено на % устройств."
}
}

@ -40,6 +40,7 @@
"Accounts_CustomFields_Description": "Anahtarların, alan ayarları sözlüğü bulunduran alan isimleri olduğu geçerli bir JSON olmalı. Örnek:<br/><code>{\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}</code> ",
"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"
}
}

@ -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;
};

@ -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;
}
}

@ -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';
}
}

@ -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) {

@ -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() {

@ -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) {

@ -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';
}
}

@ -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');

@ -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);
}

@ -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') {

@ -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);
}

@ -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,

@ -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();

@ -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 };
}

@ -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() {

@ -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;
}
}
});

@ -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;
}
}
});

@ -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;
}
}
});

@ -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;
}
}
});

@ -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;
}
}

@ -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;
}
}
});

@ -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) {

@ -30,7 +30,7 @@
<div class="input-line double-col" id="enableAutoAway">
<label>{{_ "Enable_Auto_Away"}}</label>
<div>
<label><input type="radio" name="enableAutoAway" value="1" checked="{{ checked 'enableAutoAway' true true }}"/> {{_ "True"}}</label>
<label><input type="radio" name="enableAutoAway" value="1" checked="{{ checked 'enableAutoAway' true }}"/> {{_ "True"}}</label>
<label><input type="radio" name="enableAutoAway" value="0" checked="{{ checked 'enableAutoAway' false }}"/> {{_ "False"}}</label>
</div>
</div>
@ -80,10 +80,10 @@
<label>{{_ "Notification_Desktop_Default_For"}}</label>
<div>
<select class="input-monitor" name="desktopNotifications">
<option value="default" selected="{{selected 'desktopNotifications' 'default' true}}">{{_ "Default"}} ({{_ defaultDesktopNotification}})</option>
<option value="all" selected="{{selected 'desktopNotifications' 'all' false}}">{{_ "All_messages"}}</option>
<option value="mentions" selected="{{selected 'desktopNotifications' 'mentions' false}}">{{_ "Mentions"}}</option>
<option value="nothing" selected="{{selected 'desktopNotifications' 'nothing' false}}">{{_ "Nothing"}}</option>
<option value="default" selected="{{selected 'desktopNotifications' 'default' 'default'}}">{{_ "Default"}} ({{_ defaultDesktopNotification}})</option>
<option value="all" selected="{{selected 'desktopNotifications' 'all' 'default'}}">{{_ "All_messages"}}</option>
<option value="mentions" selected="{{selected 'desktopNotifications' 'mentions' 'default'}}">{{_ "Mentions"}}</option>
<option value="nothing" selected="{{selected 'desktopNotifications' 'nothing' 'default'}}">{{_ "Nothing"}}</option>
</select>
</div>
</div>
@ -91,45 +91,45 @@
<label>{{_ "Notification_Mobile_Default_For"}}</label>
<div>
<select class="input-monitor" name="mobileNotifications">
<option value="default" selected="{{selected 'mobileNotifications' 'default' true}}">{{_ "Default"}} ({{_ defaultMobileNotification}})</option>
<option value="all" selected="{{selected 'mobileNotifications' 'all' false}}">{{_ "All_messages"}}</option>
<option value="mentions" selected="{{selected 'mobileNotifications' 'mentions' false}}">{{_ "Mentions"}}</option>
<option value="nothing" selected="{{selected 'mobileNotifications' 'nothing' false}}">{{_ "Nothing"}}</option>
<option value="default" selected="{{selected 'mobileNotifications' 'default' 'default'}}">{{_ "Default"}} ({{_ defaultMobileNotification}})</option>
<option value="all" selected="{{selected 'mobileNotifications' 'all' 'default'}}">{{_ "All_messages"}}</option>
<option value="mentions" selected="{{selected 'mobileNotifications' 'mentions' 'default'}}">{{_ "Mentions"}}</option>
<option value="nothing" selected="{{selected 'mobileNotifications' 'nothing' 'default'}}">{{_ "Nothing"}}</option>
</select>
</div>
</div>
<div class="input-line double-col" id="unreadAlert">
<label>{{_ "Unread_Tray_Icon_Alert"}}</label>
<div>
<label><input type="radio" name="unreadAlert" value="1" checked="{{checked 'unreadAlert' true true}}"/> {{_ "On"}}</label>
<label><input type="radio" name="unreadAlert" value="1" checked="{{checked 'unreadAlert' true}}"/> {{_ "On"}}</label>
<label><input type="radio" name="unreadAlert" value="0" checked="{{checked 'unreadAlert' false}}"/> {{_ "Off"}}</label>
</div>
</div>
<div class="input-line double-col">
<label>{{_ "Use_Emojis"}}</label>
<div>
<label><input type="radio" name="useEmojis" value="1" checked="{{checked 'useEmojis' true true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="useEmojis" value="1" checked="{{checked 'useEmojis' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="useEmojis" value="0" checked="{{checked 'useEmojis' false}}" /> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col" id="convertAsciiEmoji">
<label>{{_ "Convert_Ascii_Emojis"}}</label>
<div>
<label><input type="radio" name="convertAsciiEmoji" value="1" checked="{{checked 'convertAsciiEmoji' true true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="convertAsciiEmoji" value="1" checked="{{checked 'convertAsciiEmoji' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="convertAsciiEmoji" value="0" checked="{{checked 'convertAsciiEmoji' false}}" /> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col" id="autoImageLoad">
<label>{{_ "Auto_Load_Images"}}</label>
<div>
<label><input type="radio" name="autoImageLoad" value="1" checked="{{checked 'autoImageLoad' true true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="autoImageLoad" value="1" checked="{{checked 'autoImageLoad' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="autoImageLoad" value="0" checked="{{checked 'autoImageLoad' false}}" /> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col" id="saveMobileBandwidth">
<label>{{_ "Save_Mobile_Bandwidth"}}</label>
<div>
<label><input type="radio" name="saveMobileBandwidth" value="1" checked="{{checked 'saveMobileBandwidth' true true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="saveMobileBandwidth" value="1" checked="{{checked 'saveMobileBandwidth' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="saveMobileBandwidth" value="0" checked="{{checked 'saveMobileBandwidth' false}}" /> {{_ "False"}}</label>
</div>
</div>
@ -137,14 +137,14 @@
<label>{{_ "Collapse_Embedded_Media_By_Default"}}</label>
<div>
<label><input type="radio" name="collapseMediaByDefault" value="1" checked="{{checked 'collapseMediaByDefault' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="collapseMediaByDefault" value="0" checked="{{checked 'collapseMediaByDefault' false true}}" /> {{_ "False"}}</label>
<label><input type="radio" name="collapseMediaByDefault" value="0" checked="{{checked 'collapseMediaByDefault' false}}" /> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col" id="hideUsernames">
<label>{{_ "Hide_usernames"}}</label>
<div>
<label><input type="radio" name="hideUsernames" value="1" checked="{{checked 'hideUsernames' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="hideUsernames" value="0" checked="{{checked 'hideUsernames' false true}}" /> {{_ "False"}}</label>
<label><input type="radio" name="hideUsernames" value="0" checked="{{checked 'hideUsernames' false}}" /> {{_ "False"}}</label>
</div>
</div>
{{#if showRoles}}
@ -152,7 +152,7 @@
<label>{{_ "Hide_roles"}}</label>
<div>
<label><input type="radio" name="hideRoles" value="1" checked="{{checked 'hideRoles' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="hideRoles" value="0" checked="{{checked 'hideRoles' false true}}" /> {{_ "False"}}</label>
<label><input type="radio" name="hideRoles" value="0" checked="{{checked 'hideRoles' false}}" /> {{_ "False"}}</label>
</div>
</div>
{{/if}}
@ -160,14 +160,14 @@
<label>{{_ "Hide_flextab"}}</label>
<div>
<label><input type="radio" name="hideFlexTab" value="1" checked="{{checked 'hideFlexTab' true}}" /> {{_ "True"}}</label>
<label><input type="radio" name="hideFlexTab" value="0" checked="{{checked 'hideFlexTab' false true}}" /> {{_ "False"}}</label>
<label><input type="radio" name="hideFlexTab" value="0" checked="{{checked 'hideFlexTab' false}}" /> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col" id="hideAvatars">
<label>{{_ "Hide_Avatars"}}</label>
<div>
<label><input type="radio" name="hideAvatars" value="1" checked="{{checked 'hideAvatars' true}}"/> {{_ "True"}}</label>
<label><input type="radio" name="hideAvatars" value="0" checked="{{checked 'hideAvatars' false true}}"/> {{_ "False"}}</label>
<label><input type="radio" name="hideAvatars" value="0" checked="{{checked 'hideAvatars' false}}"/> {{_ "False"}}</label>
</div>
</div>
<div class="input-line double-col">
@ -176,7 +176,7 @@
<select class="input-monitor" name="roomsListExhibitionMode" id="roomsListExhibitionMode">
<option value="unread" selected="{{selected 'roomsListExhibitionMode' 'unread'}}">{{_ "Unread_Rooms_Mode"}}</option>
<option value="activity" selected="{{selected 'roomsListExhibitionMode' 'activity'}}">{{_ "Sort_by_activity"}}</option>
<option value="category" selected="{{selected 'roomsListExhibitionMode' 'category' true}}">{{_ "Split_by_categories"}}</option>
<option value="category" selected="{{selected 'roomsListExhibitionMode' 'category'}}">{{_ "Split_by_categories"}}</option>
</select>
</div>
</div>
@ -184,9 +184,9 @@
<div class="input-line double-col" id="mergeChannels" {{disabled}}>
<label>{{_ "UI_Merge_Channels_Groups"}}</label>
<div>
<label><input type="radio" name="mergeChannels" value="1" checked="{{checked 'mergeChannels' true}}" {{disabled}}/> {{_ "True"}}</label>
<label><input type="radio" name="mergeChannels" value="0" checked="{{checked 'mergeChannels' false}}" {{disabled}}/> {{_ "False"}}</label>
<label><input type="radio" name="mergeChannels" value="-1" checked="{{checked 'mergeChannels' undefined true}}" {{disabled}}/> {{_ "Default"}}</label>
<label><input type="radio" name="mergeChannels" value="1" checked="{{checked 'mergeChannels' true 'default'}}" {{disabled}}/> {{_ "True"}}</label>
<label><input type="radio" name="mergeChannels" value="0" checked="{{checked 'mergeChannels' false 'default'}}" {{disabled}}/> {{_ "False"}}</label>
<label><input type="radio" name="mergeChannels" value="-1" checked="{{checked 'mergeChannels' 'default' 'default'}}" {{disabled}}/> {{_ "Default"}}</label>
</div>
</div>
{{/with}}
@ -195,7 +195,7 @@
<label>{{_ "Enter_Behaviour"}}</label>
<div>
<select class="input-monitor" name="sendOnEnter">
<option value="normal" selected="{{selected 'sendOnEnter' 'normal' true}}">{{_ "Enter_Normal"}}</option>
<option value="normal" selected="{{selected 'sendOnEnter' 'normal'}}">{{_ "Enter_Normal"}}</option>
<option value="alternative" selected="{{selected 'sendOnEnter' 'alternative'}}">{{_ "Enter_Alternative"}}</option>
<option value="desktop" selected="{{selected 'sendOnEnter' 'desktop'}}">{{_ "Only_On_Desktop"}}</option>
</select>
@ -206,9 +206,9 @@
<label>{{_ "View_mode"}}</label>
<div>
<select class="input-monitor" name="viewMode">
<option value="0" selected="{{selected 'viewMode' 0 true}}">{{_ "Normal"}}</option>
<option value="1" selected="{{selected 'viewMode' 1 false}}">{{_ "Cozy"}}</option>
<option value="2" selected="{{selected 'viewMode' 2 false}}">{{_ "Compact"}}</option>
<option value="0" selected="{{selected 'viewMode' '0'}}">{{_ "Normal"}}</option>
<option value="1" selected="{{selected 'viewMode' '1'}}">{{_ "Cozy"}}</option>
<option value="2" selected="{{selected 'viewMode' '2'}}">{{_ "Compact"}}</option>
</select>
<div class="info">{{_ "View_mode_info"}}</div>
</div>
@ -217,8 +217,8 @@
<label>{{_ "Email_Notification_Mode"}}</label>
<div>
<select class="input-monitor" name="emailNotificationMode">
<option value="disabled" selected="{{selected 'emailNotificationMode' 'disabled' false}}">{{_ "Email_Notification_Mode_Disabled"}}</option>
<option value="all" selected="{{selected 'emailNotificationMode' 'all' true}}">{{_ "Email_Notification_Mode_All"}}</option>
<option value="disabled" selected="{{selected 'emailNotificationMode' 'disabled'}}">{{_ "Email_Notification_Mode_Disabled"}}</option>
<option value="all" selected="{{selected 'emailNotificationMode' 'all'}}">{{_ "Email_Notification_Mode_All"}}</option>
</select>
</div>
<div class="info">{{_ "You_need_to_verifiy_your_email_address_to_get_notications"}}</div>
@ -232,7 +232,7 @@
<label>{{_ "Show_room_counter_on_sidebar"}}</label>
<div>
<label><input type="radio" name="roomCounterSidebar" value="1" checked="{{checked 'roomCounterSidebar' true}}"/> {{_ "True"}}</label>
<label><input type="radio" name="roomCounterSidebar" value="0" checked="{{checked 'roomCounterSidebar' false true}}"/> {{_ "False"}}</label>
<label><input type="radio" name="roomCounterSidebar" value="0" checked="{{checked 'roomCounterSidebar' false}}"/> {{_ "False"}}</label>
</div>
</div>
</div>

@ -9,17 +9,12 @@ const notificationLabels = {
nothing: 'Nothing'
};
const DEFAULT_IDLE_TIME_LIMIT = 300000;
const userHasPreferences = (user) => {
const userHasSettings = user.hasOwnProperty('settings');
if (!userHasSettings) {
return false;
function checkedSelected(property, value, defaultValue=undefined) {
if (defaultValue && defaultValue.hash) {
defaultValue = undefined;
}
return user.settings.hasOwnProperty('preferences');
};
return RocketChat.getUserPreference(Meteor.user(), property, defaultValue) === value;
}
Template.accountPreferences.helpers({
showMergedChannels() {
@ -29,12 +24,10 @@ Template.accountPreferences.helpers({
return (RocketChat.CustomSounds && RocketChat.CustomSounds.getList && RocketChat.CustomSounds.getList()) || [];
},
newMessageNotification() {
const user = Meteor.user();
return (user && user.settings && user.settings.preferences && user.settings.preferences.newMessageNotification) || 'chime';
return RocketChat.getUserPreference(Meteor.user(), 'newMessageNotification');
},
newRoomNotification() {
const user = Meteor.user();
return (user && user.settings && user.settings.preferences && user.settings.preferences.newRoomNotification) || 'door';
return RocketChat.getUserPreference(Meteor.user(), 'newRoomNotification');
},
languages() {
const languages = TAPi18n.getLanguages();
@ -56,33 +49,15 @@ Template.accountPreferences.helpers({
}
return result;
},
checked(property, value, defaultValue) {
const user = Meteor.user();
if (!userHasPreferences(user)) {
return defaultValue;
}
const userPreferences = user.settings.preferences;
if (userPreferences.hasOwnProperty(property)) {
return value === userPreferences[property];
}
return defaultValue;
checked(property, value, defaultValue=undefined) {
return checkedSelected(property, value, defaultValue);
},
selected(property, value, defaultValue) {
const user = Meteor.user();
const propertyeExists = !!(user && user.settings && user.settings.preferences && user.settings.preferences[property]);
if (propertyeExists) {
return user.settings.preferences[property] === value;
} else {
return defaultValue === true;
}
selected(property, value, defaultValue=undefined) {
return checkedSelected(property, value, defaultValue);
},
highlights() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences['highlights'] && user.settings.preferences['highlights'].join('\n');
const userHighlights = RocketChat.getUserPreference(Meteor.user(), 'highlights');
return userHighlights ? userHighlights.join(', ') : undefined;
},
desktopNotificationEnabled() {
return KonchatNotification.notificationStatus.get() === 'granted' || (window.Notification && Notification.permission === 'granted');
@ -90,38 +65,30 @@ Template.accountPreferences.helpers({
desktopNotificationDisabled() {
return KonchatNotification.notificationStatus.get() === 'denied' || (window.Notification && Notification.permission === 'denied');
},
defaultAudioNotification() {
return notificationLabels[RocketChat.settings.get('Audio_Notifications_Default_Alert')];
},
defaultAudioNotificationValue() {
return RocketChat.settings.get('Audio_Notifications_Value');
},
desktopNotificationDuration() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.desktopNotificationDuration;
const userPref = RocketChat.getUserPreference(Meteor.user(), 'desktopNotificationDuration', 'undefined');
return userPref !== 'undefined' ? userPref : undefined;
},
defaultDesktopNotificationDuration() {
return RocketChat.settings.get('Desktop_Notifications_Duration');
return RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration');
},
idleTimeLimit() {
const user = Meteor.user();
return (user && user.settings && user.settings.preferences && user.settings.preferences.idleTimeLimit) || DEFAULT_IDLE_TIME_LIMIT;
return RocketChat.getUserPreference(Meteor.user(), 'idleTimeLimit');
},
defaultIdleTimeLimit() {
return DEFAULT_IDLE_TIME_LIMIT;
return RocketChat.settings.get('Accounts_Default_User_Preferences_idleTimeoutLimit');
},
defaultDesktopNotification() {
return notificationLabels[RocketChat.settings.get('Desktop_Notifications_Default_Alert')];
return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotifications')];
},
defaultMobileNotification() {
return notificationLabels[RocketChat.settings.get('Mobile_Notifications_Default_Alert')];
return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_mobileNotifications')];
},
showRoles() {
return RocketChat.settings.get('UI_DisplayRoles');
},
notificationsSoundVolume() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
return RocketChat.getUserPreference(Meteor.user(), 'notificationsSoundVolume');
}
});
@ -135,12 +102,8 @@ Template.accountPreferences.onCreated(function() {
settingsTemplate.child.push(this);
if (user && user.settings && user.settings.preferences) {
this.roomsListExhibitionMode = new ReactiveVar(user.settings.preferences.roomsListExhibitionMode || 'category');
this.useEmojis = new ReactiveVar(user.settings.preferences.desktopNotificationDuration == null || user.settings.preferences.useEmojis);
} else {
this.roomsListExhibitionMode = new ReactiveVar('category');
}
this.roomsListExhibitionMode = new ReactiveVar(RocketChat.getUserPreference(user, 'roomsListExhibitionMode'));
this.useEmojis = new ReactiveVar(RocketChat.getUserPreference(user, 'useEmojis'));
let instance = this;
@ -177,7 +140,6 @@ Template.accountPreferences.onCreated(function() {
data.hideAvatars = $('#hideAvatars').find('input:checked').val();
data.mergeChannels = $('#mergeChannels').find('input:checked').val();
data.sendOnEnter = $('#sendOnEnter').find('select').val();
data.unreadRoomsMode = $('input[name=unreadRoomsMode]:checked').val();
data.roomsListExhibitionMode = $('select[name=roomsListExhibitionMode]').val();
data.autoImageLoad = $('input[name=autoImageLoad]:checked').val();
data.emailNotificationMode = $('select[name=emailNotificationMode]').val();
@ -201,16 +163,11 @@ Template.accountPreferences.onCreated(function() {
let reload = false;
// if highlights changed we need page reload
const user = Meteor.user();
if (user &&
user.settings &&
user.settings.preferences &&
user.settings.preferences['highlights'] &&
user.settings.preferences['highlights'].join('\n') !== data.highlights.join('\n')) {
const highlights = RocketChat.getUserPreference(Meteor.user(), 'highlights');
if (highlights && highlights.join('\n') !== data.highlights.join('\n')) {
reload = true;
}
if (this.shouldUpdateLocalStorageSetting('userLanguage', selectedLanguage)) {
localStorage.setItem('userLanguage', selectedLanguage);
data.language = selectedLanguage;

@ -192,9 +192,7 @@ Template.main.onRendered(function() {
cancelButtonText: t('Cancel')
});
const user = Meteor.user();
const settings = user && user.settings;
const prefs = settings && settings.preferences;
if (prefs && prefs.hideUsernames != null) {
if (RocketChat.getUserPreference(user, 'hideUsernames')) {
$(document.body).on('mouseleave', 'button.thumb', function() {
return RocketChat.tooltip.hide();
});

@ -13,8 +13,7 @@ Template.message.helpers({
},
roleTags() {
const user = Meteor.user();
// test user -> settings -> preferences -> hideRoles
if (!RocketChat.settings.get('UI_DisplayRoles') || (user && ['settings', 'preferences', 'hideRoles'].reduce((obj, field) => typeof obj !== 'undefined' && obj[field], user))) {
if (!RocketChat.settings.get('UI_DisplayRoles') || RocketChat.getUserPreference(user, 'hideRoles')) {
return [];
}

@ -49,7 +49,8 @@ Template.roomList.helpers({
query.tokens = { $exists: false };
}
if (user && user.settings && user.settings.preferences && user.settings.preferences.roomsListExhibitionMode === 'unread') {
if (RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'unread') {
query.$or = [
{alert: {$ne: true}},
{hideUnreadStatus: true}
@ -98,8 +99,7 @@ Template.roomList.helpers({
},
showRoomCounter() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.roomCounterSidebar;
return RocketChat.getUserPreference(Meteor.user(), 'roomCounterSidebar');
}
});

@ -85,11 +85,7 @@ Template.sideNav.onCreated(function() {
'settings.preferences.mergeChannels': 1
}
});
let userPref = null;
if (user && user.settings && user.settings.preferences) {
userPref = user.settings.preferences.roomsListExhibitionMode === 'category' && user.settings.preferences.mergeChannels;
}
this.mergedChannels.set((userPref != null) ? userPref : RocketChat.settings.get('UI_Merge_Channels_Groups'));
const userPref = RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'category' && RocketChat.getUserPreference(user, 'mergeChannels');
this.mergedChannels.set(userPref ? userPref : RocketChat.settings.get('UI_Merge_Channels_Groups'));
});
});

@ -422,7 +422,7 @@ this.ChatMessages = class ChatMessages {
keydown(rid, event) {
const user = Meteor.user();
const sendOnEnter = user && user.settings && user.settings.preferences && user.settings.preferences.sendOnEnter;
const sendOnEnter = RocketChat.getUserPreference(user, 'sendOnEnter');
const input = event.currentTarget;
// const $input = $(input);
const k = event.which;

@ -30,8 +30,7 @@ const KonchatNotification = {
});
const user = Meteor.user();
const notificationDuration = notification.duration - 0 || user && user.settings && user.settings.preferences && user.settings.preferences.desktopNotificationDuration - 0 || RocketChat.settings.get('Desktop_Notifications_Duration');
const notificationDuration = notification.duration - 0 || RocketChat.getUserPreference(user, 'desktopNotificationDuration') - 0;
if (notificationDuration > 0) {
setTimeout((() => n.close()), notificationDuration * 1000);
}
@ -82,8 +81,8 @@ const KonchatNotification = {
newMessage(rid) {
if (!Session.equals(`user_${ Meteor.user().username }_status`, 'busy')) {
const user = Meteor.user();
const newMessageNotification = user && user.settings && user.settings.preferences && user.settings.preferences.newMessageNotification || 'chime';
const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
const newMessageNotification = RocketChat.getUserPreference(user, 'newMessageNotification');
const audioVolume = RocketChat.getUserPreference(user, 'notificationsSoundVolume');
const sub = ChatSubscription.findOne({ rid }, { fields: { audioNotificationValue: 1 } });
@ -135,8 +134,8 @@ Meteor.startup(() => {
'settings.preferences.notificationsSoundVolume': 1
}
});
const newRoomNotification = user && user.settings && user.settings.preferences && user.settings.preferences.newRoomNotification || 'door';
const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
const newRoomNotification = RocketChat.getUserPreference(user, 'newRoomNotification');
const audioVolume = RocketChat.getUserPreference(user, 'notificationsSoundVolume');
if ((Session.get('newRoomSound') || []).length > 0) {
Meteor.defer(function() {

@ -338,7 +338,7 @@ Template.room.helpers({
viewMode() {
const user = Meteor.user();
const viewMode = user && user.settings && user.settings.preferences && user.settings.preferences.viewMode;
const viewMode = RocketChat.getUserPreference(user, 'viewMode');
const modes = ['', 'cozy', 'compact'];
return modes[viewMode] || modes[0];
},
@ -349,12 +349,12 @@ Template.room.helpers({
hideUsername() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.hideUsernames ? 'hide-usernames' : undefined;
return RocketChat.getUserPreference(user, 'hideUsernames') ? 'hide-usernames' : undefined;
},
hideAvatar() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.hideAvatars ? 'hide-avatars' : undefined;
return RocketChat.getUserPreference(user, 'hideAvatars') ? 'hide-avatars' : undefined;
},
userCanDrop() {
@ -416,7 +416,7 @@ Template.room.events({
'click .messages-container-main'() {
const user = Meteor.user();
if ((Template.instance().tabBar.getState() === 'opened') && user && user.settings && user.settings.preferences && user.settings.preferences.hideFlexTab) {
if ((Template.instance().tabBar.getState() === 'opened') && RocketChat.getUserPreference(user, 'hideFlexTab')) {
Template.instance().tabBar.close();
}
},

@ -62,7 +62,7 @@ Meteor.methods({
if (channelType !== 'public' && RocketChat.authz.hasPermission(Meteor.userId(), 'view-p-room')) {
const user = Meteor.user();
const userPref = user && user.settings && user.settings.preferences && user.settings.preferences.mergeChannels && user.settings.preferences.roomsListExhibitionMode === 'category';
const userPref = RocketChat.getUserPreference(user, 'mergeChannels') && RocketChat.getUserPreference(user, 'roomsListExhibitionMode') === 'category';
const globalPref = RocketChat.settings.get('UI_Merge_Channels_Groups');
const mergeChannels = userPref !== undefined ? userPref : globalPref;

@ -33,10 +33,6 @@ Meteor.methods({
preferences.collapseMediaByDefault = settings.collapseMediaByDefault === '1' ? true : false;
}
if (settings.unreadRoomsMode) {
preferences.unreadRoomsMode = settings.unreadRoomsMode === '1' ? true : false;
}
if (settings.autoImageLoad) {
preferences.autoImageLoad = settings.autoImageLoad === '1' ? true : false;
}
@ -50,11 +46,9 @@ Meteor.methods({
} else {
delete preferences.mergeChannels;
}
if (settings.unreadRoomsMode) {
preferences.unreadRoomsMode = settings.unreadRoomsMode === '1' ? true : false;
}
preferences.roomsListExhibitionMode = ['category', 'unread', 'activity'].includes(settings.roomsListExhibitionMode) ? settings.roomsListExhibitionMode : 'category';
if (settings.unreadAlert) {
preferences.unreadAlert = settings.unreadAlert === '1' ? true : false;
}
@ -66,9 +60,11 @@ Meteor.methods({
if (settings.audioNotifications) {
preferences.audioNotifications = settings.audioNotifications;
}
if (settings.desktopNotifications) {
preferences.desktopNotifications = settings.desktopNotifications;
}
if (settings.mobileNotifications) {
preferences.mobileNotifications = settings.mobileNotifications;
}
@ -78,14 +74,16 @@ Meteor.methods({
preferences.enableAutoAway = settings.enableAutoAway === '1';
preferences.audioNotificationValue = settings.audioNotificationValue - 0;
if (settings.highlights) {
preferences.highlights = settings.highlights;
}
preferences.desktopNotificationDuration = settings.desktopNotificationDuration - 0;
preferences.viewMode = settings.viewMode || 0;
preferences.hideUsernames = settings.hideUsernames === '1';
preferences.hideRoles = settings.hideRoles === '1';
preferences.hideAvatars = settings.hideAvatars === '1';
preferences.hideFlexTab = settings.hideFlexTab === '1';
preferences.highlights = settings.highlights;
preferences.sendOnEnter = settings.sendOnEnter;
preferences.roomCounterSidebar = settings.roomCounterSidebar === '1';

@ -0,0 +1,31 @@
RocketChat.Migrations.add({
version: 105,
up() {
if (RocketChat && RocketChat.models) {
if (RocketChat.models.Users) {
RocketChat.models.Users.find({ 'settings.preferences.unreadRoomsMode': { $exists: 1 } }).forEach(function(user) {
const newPreference = user.settings.preferences.unreadRoomsMode ? 'unread' : 'category';
RocketChat.models.Users.update({ _id: user._id }, { $unset: { 'settings.preferences.unreadRoomsMode': 1 }, $set: { 'settings.preferences.roomsListExhibitionMode': newPreference } });
});
}
if (RocketChat.models.Settings) {
const settingsMap = {
'Desktop_Notifications_Default_Alert': 'Accounts_Default_User_Preferences_desktopNotifications',
'Mobile_Notifications_Default_Alert': 'Accounts_Default_User_Preferences_mobileNotifications',
'Audio_Notifications_Default_Alert': 'Accounts_Default_User_Preferences_audioNotifications',
'Desktop_Notifications_Duration': 'Accounts_Default_User_Preferences_desktopNotificationDuration',
'Audio_Notifications_Value': undefined
};
RocketChat.models.Settings.find({ _id: { $in: Object.keys(settingsMap) }}).forEach(oldSetting => {
const newSettingKey = settingsMap[oldSetting._id];
const newSetting = newSettingKey && RocketChat.models.Settings.findOne({ _id: newSettingKey });
if (newSetting && newSetting.value !== oldSetting.value) {
RocketChat.models.Settings.update({ _id: newSettingKey }, { $set: { value: oldSetting.value } });
}
RocketChat.models.Settings.remove({_id: oldSetting._id });
});
}
}
}
});

@ -637,12 +637,12 @@ describe('[Administration]', () => {
before(() => {
admin.generalButtonExpandNotifications.waitForVisible(5000);
admin.generalButtonExpandNotifications.click();
admin.generalNotificationDuration.waitForVisible(5000);
admin.generalNotificationDuration.scroll();
admin.generalNotificationsMaxRoomMembers.waitForVisible(5000);
admin.generalNotificationsMaxRoomMembers.scroll();
});
it('it should show the notifications durations field', () => {
admin.generalNotificationDuration.isVisible().should.be.true;
it('it should show the max room members field', () => {
admin.generalNotificationsMaxRoomMembers.isVisible().should.be.true;
});
});
@ -704,5 +704,251 @@ describe('[Administration]', () => {
});
});
});
describe('[Accounts]', () => {
before(() => {
admin.settingsSearch.setValue('accounts');
admin.accountsLink.waitForVisible(5000);
admin.accountsLink.click();
admin.settingsSearch.setValue('');
});
describe('default user preferences', () => {
before(() => {
if (admin.accountsButtonCollapseDefaultUserPreferences.isVisible()) {
admin.accountsButtonCollapseDefaultUserPreferences.click();
}
admin.accountsButtonExpandDefaultUserPreferences.waitForVisible(5000);
admin.accountsButtonExpandDefaultUserPreferences.click();
admin.accountsNotificationDuration.waitForVisible(5000);
});
it('it should show the enable auto away field', () => {
admin.accountsEnableAutoAwayTrue.scroll();
admin.accountsEnableAutoAwayTrue.isVisible().should.be.true;
admin.accountsEnableAutoAwayFalse.isVisible().should.be.true;
});
it('the enable auto away field value should be true', () => {
admin.accountsEnableAutoAwayTrue.isSelected().should.be.false;
admin.accountsEnableAutoAwayFalse.isSelected().should.be.true;
});
it('it should show the idle timeout limit field', () => {
admin.accountsIdleTimeoutLimit.click();
admin.accountsIdleTimeoutLimit.isVisible().should.be.true;
});
it('the idle timeout limit field value should be 0', () => {
admin.accountsIdleTimeoutLimit.getValue().should.equal('300000');
});
it('it should show the notifications durations field', () => {
admin.accountsNotificationDuration.click();
admin.accountsNotificationDuration.isVisible().should.be.true;
});
it('the notification duration field value should be 0', () => {
admin.accountsNotificationDuration.getValue().should.equal('0');
});
it('it should show the audio notifications select field', () => {
admin.accountsAudioNotifications.click();
admin.accountsAudioNotifications.isVisible().should.be.true;
});
it('the audio notifications field value should be mentions', () => {
admin.accountsAudioNotifications.getValue().should.equal('mentions');
});
it('it should show the desktop audio notifications select field', () => {
admin.accountsDesktopNotifications.click();
admin.accountsDesktopNotifications.isVisible().should.be.true;
});
it('the desktop audio notifications field value should be mentions', () => {
admin.accountsDesktopNotifications.getValue().should.equal('mentions');
});
it('it should show the mobile audio notifications select field', () => {
admin.accountsMobileNotifications.click();
admin.accountsMobileNotifications.isVisible().should.be.true;
});
it('the mobile audio notifications field value should be mentions', () => {
admin.accountsMobileNotifications.getValue().should.equal('mentions');
});
it('it should show the unread tray icon alert field', () => {
admin.accountsUnreadAlertTrue.scroll();
admin.accountsUnreadAlertTrue.isVisible().should.be.true;
admin.accountsUnreadAlertFalse.isVisible().should.be.true;
});
it('the unread tray icon alert field value should be true', () => {
admin.accountsUnreadAlertTrue.isSelected().should.be.true;
admin.accountsUnreadAlertFalse.isSelected().should.be.false;
});
it('it should show the use emojis field', () => {
admin.accountsUseEmojisTrue.scroll();
admin.accountsUseEmojisTrue.isVisible().should.be.true;
admin.accountsUseEmojisFalse.isVisible().should.be.true;
});
it('the use emojis field value should be true', () => {
admin.accountsUseEmojisTrue.isSelected().should.be.true;
admin.accountsUseEmojisFalse.isSelected().should.be.false;
});
it('it should show the convert ascii to emoji field', () => {
admin.accountsConvertAsciiEmojiTrue.scroll();
admin.accountsConvertAsciiEmojiTrue.isVisible().should.be.true;
admin.accountsConvertAsciiEmojiFalse.isVisible().should.be.true;
});
it('the convert ascii to emoji field value should be true', () => {
admin.accountsConvertAsciiEmojiTrue.isSelected().should.be.true;
admin.accountsConvertAsciiEmojiFalse.isSelected().should.be.false;
});
it('it should show the auto load images field', () => {
admin.accountsAutoImageLoadTrue.scroll();
admin.accountsAutoImageLoadTrue.isVisible().should.be.true;
admin.accountsAutoImageLoadFalse.isVisible().should.be.true;
});
it('the auto load images field value should be true', () => {
admin.accountsAutoImageLoadTrue.isSelected().should.be.true;
admin.accountsAutoImageLoadFalse.isSelected().should.be.false;
});
it('it should show the save mobile bandwidth field', () => {
admin.accountsSaveMobileBandwidthTrue.scroll();
admin.accountsSaveMobileBandwidthTrue.isVisible().should.be.true;
admin.accountsSaveMobileBandwidthFalse.isVisible().should.be.true;
});
it('the save mobile bandwidth field value should be true', () => {
admin.accountsSaveMobileBandwidthTrue.isSelected().should.be.true;
admin.accountsSaveMobileBandwidthFalse.isSelected().should.be.false;
});
it('it should show the collapse embedded media by default field', () => {
admin.accountsCollapseMediaByDefaultTrue.scroll();
admin.accountsCollapseMediaByDefaultTrue.isVisible().should.be.true;
admin.accountsCollapseMediaByDefaultFalse.isVisible().should.be.true;
});
it('the collapse embedded media by default field value should be false', () => {
admin.accountsCollapseMediaByDefaultTrue.isSelected().should.be.false;
admin.accountsCollapseMediaByDefaultFalse.isSelected().should.be.true;
});
it('it should show the hide usernames field', () => {
admin.accountsHideUsernamesTrue.scroll();
admin.accountsHideUsernamesTrue.isVisible().should.be.true;
admin.accountsHideUsernamesFalse.isVisible().should.be.true;
});
it('the hide usernames field value should be false', () => {
admin.accountsHideUsernamesTrue.isSelected().should.be.false;
admin.accountsHideUsernamesFalse.isSelected().should.be.true;
});
it('it should show the hide roles field', () => {
admin.accountsHideRolesTrue.scroll();
admin.accountsHideRolesTrue.isVisible().should.be.true;
admin.accountsHideRolesFalse.isVisible().should.be.true;
});
it('the hide roles field value should be false', () => {
admin.accountsHideRolesTrue.isSelected().should.be.false;
admin.accountsHideRolesFalse.isSelected().should.be.true;
});
it('it should show the hide right sidebar with click field', () => {
admin.accountsHideFlexTabTrue.scroll();
admin.accountsHideFlexTabTrue.isVisible().should.be.true;
admin.accountsHideFlexTabFalse.isVisible().should.be.true;
});
it('the hide right sidebar with click field value should be false', () => {
admin.accountsHideFlexTabTrue.isSelected().should.be.false;
admin.accountsHideFlexTabFalse.isSelected().should.be.true;
});
it('it should show the hide avatars field', () => {
admin.accountsHideAvatarsTrue.scroll();
admin.accountsHideAvatarsTrue.isVisible().should.be.true;
admin.accountsHideAvatarsFalse.isVisible().should.be.true;
});
it('the hide avatars field value should be false', () => {
admin.accountsHideAvatarsTrue.isSelected().should.equal.false;
admin.accountsHideAvatarsFalse.isSelected().should.equal.true;
});
it('it should show the sidebar channel list mode field', () => {
admin.accountsRoomsListExhibitionMode.click();
admin.accountsRoomsListExhibitionMode.isVisible().should.be.true;
});
it('the sidebar channel list mode field value should be category', () => {
admin.accountsRoomsListExhibitionMode.getValue().should.equal('category');
});
it('it should show the merge channels field', () => {
admin.accountsMergeChannelsTrue.scroll();
admin.accountsMergeChannelsTrue.isVisible().should.be.true;
admin.accountsMergeChannelsFalse.isVisible().should.be.true;
});
it('the merge channels field value should be false', () => {
admin.accountsMergeChannelsTrue.isSelected().should.be.false;
admin.accountsMergeChannelsFalse.isSelected().should.be.true;
});
it('it should show the enter key behavior field', () => {
admin.accountsSendOnEnter.click();
admin.accountsSendOnEnter.isVisible().should.be.true;
});
it('the enter key behavior field value should be normal', () => {
admin.accountsSendOnEnter.getValue().should.equal('normal');
});
it('it should show the view mode field', () => {
admin.accountsViewMode.click();
admin.accountsViewMode.isVisible().should.be.true;
});
it('the view mode field value should be 0', () => {
admin.accountsViewMode.getValue().should.equal('0');
});
it('it should show the offline email notification field', () => {
admin.accountsEmailNotificationMode.click();
admin.accountsEmailNotificationMode.isVisible().should.be.true;
});
it('the offline email notification field value should be all', () => {
admin.accountsEmailNotificationMode.getValue().should.equal('all');
});
it('it should show the room counter sidebar field', () => {
admin.accountsRoomCounterSidebarTrue.scroll();
admin.accountsRoomCounterSidebarTrue.isVisible().should.be.true;
admin.accountsRoomCounterSidebarFalse.isVisible().should.be.true;
});
it('the room counter sidebar field value should be false', () => {
admin.accountsRoomCounterSidebarTrue.isSelected().should.be.false;
admin.accountsRoomCounterSidebarFalse.isSelected().should.be.true;
});
it('it should show the new room notification field', () => {
admin.accountsNewRoomNotification.click();
admin.accountsNewRoomNotification.isVisible().should.be.true;
});
it('the new room notification field value should be door', () => {
admin.accountsNewRoomNotification.getValue().should.equal('door');
});
it('it should show the new message notification field', () => {
admin.accountsNewMessageNotification.click();
admin.accountsNewMessageNotification.isVisible().should.be.true;
});
it('the new message notification field value should be chime', () => {
admin.accountsNewMessageNotification.getValue().should.equal('chime');
});
it('it should show the notification sound volume field', () => {
admin.accountsNotificationsSoundVolume.click();
admin.accountsNotificationsSoundVolume.isVisible().should.be.true;
});
it('the notification sound volume field value should be 100', () => {
admin.accountsNotificationsSoundVolume.getValue().should.equal('100');
});
});
});
});
});

@ -107,8 +107,8 @@ class Administration extends Page {
get generalIframeRecieveFalseReset() { return browser.element('.reset-setting[data-setting="Iframe_Integration_receive_enable"]'); }
get generalIframeRecieveOrigin() { return browser.element('[name="Iframe_Integration_receive_origin"]'); }
get generalIframeRecieveOriginReset() { return browser.element('.reset-setting[data-setting="Iframe_Integration_receive_origin"]'); }
get generalNotificationDuration() { return browser.element('[name="Desktop_Notifications_Duration"]'); }
get generalNotificationDurationReset() { return browser.element('.reset-setting[data-setting="Desktop_Notifications_Duration"]'); }
get generalNotificationsMaxRoomMembers() { return browser.element('[name="Notifications_Max_Room_Members"]'); }
get generalNotificationsMaxRoomMembersReset() { return browser.element('.reset-setting[data-setting="Notifications_Max_Room_Members"]'); }
get generalRestApiUserLimit() { return browser.element('[name="API_User_Limit"]'); }
get generalRestApiUserLimitReset() { return browser.element('.reset-setting[data-setting="API_User_Limit"]'); }
get generalReportingTrue() { return browser.element('label:nth-of-type(1) [name="Statistics_reporting"]'); }
@ -122,8 +122,101 @@ class Administration extends Page {
get generalUTF8NamesSlugFalse() { return browser.element('label:nth-of-type(2) [name="UTF8_Names_Slugify"]'); }
get generalUTF8NamesSlugReset() { return browser.element('.reset-setting[data-setting="UTF8_Names_Slugify"]'); }
//accounts
get accountsButtonExpandDefaultUserPreferences() { return browser.element('.section:nth-of-type(3) .button.expand'); }
get accountsButtonCollapseDefaultUserPreferences() { return browser.element('.section:nth-of-type(3) .button.collapse'); }
get accountsEnableAutoAwayTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_enableAutoAway"]'); }
get accountsEnableAutoAwayFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_enableAutoAway"]'); }
get accountsEnableAutoAwayReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_enableAutoAway"]'); }
get accountsIdleTimeoutLimit() { return browser.element('[name="Accounts_Default_User_Preferences_idleTimeoutLimit"]'); }
get accountsIdleTimeoutLimitReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_idleTimeoutLimit"]'); }
get accountsNotificationDuration() { return browser.element('[name="Accounts_Default_User_Preferences_desktopNotificationDuration"]'); }
get accountsNotificationDurationReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_desktopNotificationDuration"]'); }
get accountsAudioNotifications() { return browser.element('[name="Accounts_Default_User_Preferences_audioNotifications"]'); }
get accountsAudioNotificationsReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_audioNotifications"]'); }
get accountsDesktopNotifications() { return browser.element('[name="Accounts_Default_User_Preferences_desktopNotifications"]'); }
get accountsDesktopNotificationsReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_desktopNotifications"]'); }
get accountsMobileNotifications() { return browser.element('[name="Accounts_Default_User_Preferences_mobileNotifications"]'); }
get accountsMobileNotificationsReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_mobileNotifications"]'); }
get accountsUnreadAlertTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_unreadAlert"]'); }
get accountsUnreadAlertFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_unreadAlert"]'); }
get accountsUnreadAlertReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_unreadAlert"]'); }
get accountsUseEmojisTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_useEmojis"]'); }
get accountsUseEmojisFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_useEmojis"]'); }
get accountsUseEmojisReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_useEmojis"]'); }
get accountsConvertAsciiEmojiTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_convertAsciiEmoji"]'); }
get accountsConvertAsciiEmojiFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_convertAsciiEmoji"]'); }
get accountsConvertAsciiEmojiReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_convertAsciiEmoji"]'); }
get accountsAutoImageLoadTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_autoImageLoad"]'); }
get accountsAutoImageLoadFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_autoImageLoad"]'); }
get accountsAutoImageLoadReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_autoImageLoad"]'); }
get accountsSaveMobileBandwidthTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_saveMobileBandwidth"]'); }
get accountsSaveMobileBandwidthFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_saveMobileBandwidth"]'); }
get accountsSaveMobileBandwidthReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_saveMobileBandwidth"]'); }
get accountsCollapseMediaByDefaultTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_collapseMediaByDefault"]'); }
get accountsCollapseMediaByDefaultFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_collapseMediaByDefault"]'); }
get accountsCollapseMediaByDefaultReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_collapseMediaByDefault"]'); }
get accountsHideUsernamesTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_hideUsernames"]'); }
get accountsHideUsernamesFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_hideUsernames"]'); }
get accountsHideUsernamesReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_hideUsernames"]'); }
get accountsHideRolesTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_hideRoles"]'); }
get accountsHideRolesFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_hideRoles"]'); }
get accountsHideRolesReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_hideRoles"]'); }
get accountsHideFlexTabTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_hideFlexTab"]'); }
get accountsHideFlexTabFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_hideFlexTab"]'); }
get accountsHideFlexTabReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_hideFlexTab"]'); }
get accountsHideAvatarsTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_hideAvatars"]'); }
get accountsHideAvatarsFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_hideAvatars"]'); }
get accountsHideAvatarsReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_hideAvatars"]'); }
get accountsRoomsListExhibitionMode() { return browser.element('[name="Accounts_Default_User_Preferences_roomsListExhibitionMode"]'); }
get accountsRoomsListExhibitionModeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_roomsListExhibitionMode"]'); }
get accountsMergeChannelsTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_mergeChannels"]'); }
get accountsMergeChannelsFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_mergeChannels"]'); }
get accountsMergeChannelsReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_mergeChannels"]'); }
get accountsSendOnEnter() { return browser.element('[name="Accounts_Default_User_Preferences_sendOnEnter"]'); }
get accountsSendOnEnterReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_sendOnEnter"]'); }
get accountsViewMode() { return browser.element('[name="Accounts_Default_User_Preferences_viewMode"]'); }
get accountsViewModeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_viewMode"]'); }
get accountsEmailNotificationMode() { return browser.element('[name="Accounts_Default_User_Preferences_emailNotificationMode"]'); }
get accountsEmailNotificationModeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_emailNotificationMode"]'); }
get accountsRoomCounterSidebarTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_Default_User_Preferences_roomCounterSidebar"]'); }
get accountsRoomCounterSidebarFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_Default_User_Preferences_roomCounterSidebar"]'); }
get accountsRoomCounterSidebarReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_roomCounterSidebar"]'); }
get accountsNewRoomNotification() { return browser.element('[name="Accounts_Default_User_Preferences_newRoomNotification"]'); }
get accountsNewRoomNotificationReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_newRoomNotification"]'); }
get accountsNewMessageNotification() { return browser.element('[name="Accounts_Default_User_Preferences_newMessageNotification"]'); }
get accountsNewMessageNotificationReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_newMessageNotification"]'); }
get accountsNotificationsSoundVolume() { return browser.element('[name="Accounts_Default_User_Preferences_notificationsSoundVolume"]'); }
get accountsNotificationsSoundVolumeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_notificationsSoundVolume"]'); }
get accountsRealNameChangeTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_AllowRealNameChange"]'); }
get accountsRealNameChangeFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_AllowRealNameChange"]'); }
get accountsUsernameChangeTrue() { return browser.element('label:nth-of-type(1) [name="Accounts_AllowUsernameChange"]'); }
get accountsUsernameChangeFalse() { return browser.element('label:nth-of-type(2) [name="Accounts_AllowUsernameChange"]'); }

Loading…
Cancel
Save