diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 41b1908e1ba6..77bb179bdd01 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -790,7 +790,7 @@ "Hide_Unread_Room_Status": "Hide Unread Room Status", "Hide_usernames": "Hide Usernames", "Highlights": "Highlights", - "Highlights_How_To": "To be notified when someone mentions a word or phrase, add it here. You can separate words or phrases with commas. Highlight Words are not case sensitive.", + "Highlights_How_To": "To be notified when someone mentions a word or phrase, add it here. You can separate words or phrases with . Highlight Words are not case sensitive.", "Highlights_List": "Highlight words", "History": "History", "Host": "Host", diff --git a/packages/rocketchat-ui-account/client/accountPreferences.js b/packages/rocketchat-ui-account/client/accountPreferences.js index 5dde019eab70..8dc59e2074e0 100644 --- a/packages/rocketchat-ui-account/client/accountPreferences.js +++ b/packages/rocketchat-ui-account/client/accountPreferences.js @@ -82,7 +82,7 @@ Template.accountPreferences.helpers({ }, highlights() { const user = Meteor.user(); - return user && user.settings && user.settings.preferences && user.settings.preferences['highlights'] && user.settings.preferences['highlights'].join(', '); + return user && user.settings && user.settings.preferences && user.settings.preferences['highlights'] && user.settings.preferences['highlights'].join('\n'); }, desktopNotificationEnabled() { return KonchatNotification.notificationStatus.get() === 'granted' || (window.Notification && Notification.permission === 'granted'); @@ -187,7 +187,7 @@ Template.accountPreferences.onCreated(function() { data.unreadAlert = $('#unreadAlert').find('input:checked').val(); data.notificationsSoundVolume = parseInt($('#notificationsSoundVolume').val()); data.roomCounterSidebar = $('#roomCounterSidebar').find('input:checked').val(); - data.highlights = _.compact(_.map($('[name=highlights]').val().split(','), function(e) { + data.highlights = _.compact(_.map($('[name=highlights]').val().split('\n'), function(e) { return s.trim(e); })); @@ -200,6 +200,17 @@ 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')) { + reload = true; + } + + if (this.shouldUpdateLocalStorageSetting('userLanguage', selectedLanguage)) { localStorage.setItem('userLanguage', selectedLanguage); data.language = selectedLanguage;