diff --git a/app/api/server/v1/users.js b/app/api/server/v1/users.js
index f93dec90c0fd3..f182e6b4de187 100644
--- a/app/api/server/v1/users.js
+++ b/app/api/server/v1/users.js
@@ -511,6 +511,7 @@ API.v1.addRoute('users.setPreferences', { authRequired: true }, {
enableAutoAway: Match.Maybe(Boolean),
highlights: Match.Maybe(Array),
desktopNotificationDuration: Match.Maybe(Number),
+ desktopNotificationRequireInteraction: Match.Maybe(Boolean),
messageViewMode: Match.Maybe(Number),
hideUsernames: Match.Maybe(Boolean),
hideRoles: Match.Maybe(Boolean),
diff --git a/app/lib/server/startup/settings.js b/app/lib/server/startup/settings.js
index fa594ffe644e9..a00da13f57bdf 100644
--- a/app/lib/server/startup/settings.js
+++ b/app/lib/server/startup/settings.js
@@ -221,6 +221,12 @@ settings.addGroup('Accounts', function() {
public: true,
i18nLabel: 'Notification_Duration',
});
+ this.add('Accounts_Default_User_Preferences_desktopNotificationRequireInteraction', false, {
+ type: 'boolean',
+ public: true,
+ i18nLabel: 'Notification_RequireInteraction',
+ i18nDescription: 'Notification_RequireInteraction_Description',
+ });
this.add('Accounts_Default_User_Preferences_audioNotifications', 'mentions', {
type: 'select',
values: [
diff --git a/app/ui-account/client/accountPreferences.html b/app/ui-account/client/accountPreferences.html
index 76e95a26c0388..d60c59f54fcc3 100644
--- a/app/ui-account/client/accountPreferences.html
+++ b/app/ui-account/client/accountPreferences.html
@@ -102,6 +102,14 @@
{{_ "Notifications"}}
{{/if}}
+
diff --git a/app/ui-account/client/accountPreferences.js b/app/ui-account/client/accountPreferences.js
index a5dd308d37dfb..64a67e48aee38 100644
--- a/app/ui-account/client/accountPreferences.js
+++ b/app/ui-account/client/accountPreferences.js
@@ -87,6 +87,13 @@ Template.accountPreferences.helpers({
defaultDesktopNotificationDuration() {
return settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration');
},
+ desktopNotificationRequireInteraction() {
+ const userPref = getUserPreference(Meteor.userId(), 'desktopNotificationRequireInteraction', 'undefined');
+ return userPref !== 'undefined' ? userPref : undefined;
+ },
+ defaultDesktopNotificationRequireInteraction() {
+ return settings.get('Accounts_Default_User_Preferences_desktopNotificationRequireInteraction');
+ },
idleTimeLimit() {
return getUserPreference(Meteor.userId(), 'idleTimeLimit');
},
@@ -182,6 +189,12 @@ Template.accountPreferences.onCreated(function() {
data.hideRoles = JSON.parse($('#hideRoles').find('input:checked').val());
}
+ if ($('input[name=desktopNotificationRequireInteraction]:checked').val() === undefined) {
+ data.desktopNotificationRequireInteraction = settings.get('Accounts_Default_User_Preferences_desktopNotificationRequireInteraction');
+ } else {
+ data.desktopNotificationRequireInteraction = JSON.parse($('input[name=desktopNotificationRequireInteraction]:checked').val());
+ }
+
// if highlights changed we need page reload
const highlights = getUserPreference(Meteor.userId(), 'highlights');
if (highlights && highlights.join('\n') !== data.highlights.join('\n')) {
diff --git a/app/ui/client/lib/notification.js b/app/ui/client/lib/notification.js
index c257e993b7ebd..fe86d27c0b5bd 100644
--- a/app/ui/client/lib/notification.js
+++ b/app/ui/client/lib/notification.js
@@ -41,6 +41,7 @@ export const KonchatNotification = {
tag: notification.payload._id,
silent: true,
canReply: true,
+ requireInteraction: getUserPreference(Meteor.userId(), 'desktopNotificationRequireInteraction'),
});
const notificationDuration = notification.duration - 0 || getUserPreference(Meteor.userId(), 'desktopNotificationDuration') - 0;
diff --git a/packages/rocketchat-i18n/i18n/de-IN.i18n.json b/packages/rocketchat-i18n/i18n/de-IN.i18n.json
index 45e2f10161e83..3599057b96c40 100644
--- a/packages/rocketchat-i18n/i18n/de-IN.i18n.json
+++ b/packages/rocketchat-i18n/i18n/de-IN.i18n.json
@@ -2166,6 +2166,8 @@
"Not_Imported_Messages_Title": "Der Import folgender Nachrichten schlug fehl",
"Notification_Desktop_Default_For": "Desktop-Benachrichtigungen anzeigen für",
"Notification_Duration": "Benachrichtigungsdauer",
+ "Notification_RequireInteraction": "Der Benutzer muss mit der Desktop-Benachrichtigung interagieren um diese auszublenden",
+ "Notification_RequireInteraction_Description": "Verwendung nur mit Chrome Browser Version > 50 möglich. Verwendet den Parameter requireInteraction um die Anzeigedauer der Desktop-Benachrichtigung bis zur Benutzerinteraktion zu verlängern.",
"Notification_Mobile_Default_For": "Mobile Benachrichtigungen anzeigen für",
"Notifications": "Benachrichtigungen",
"Notifications_Always_Notify_Mobile": "Immer das Mobiltelefon benachrichtigen",
@@ -2214,6 +2216,7 @@
"Only_authorized_users_can_write_new_messages": "Nur Authentifizierte Benutzer können neue Nachrichten schreiben",
"Only_from_users": "Löscht nur den Inhalt dieser Benutzer",
"Only_On_Desktop": "Desktop Modus (senden mit der Eingabeaste nur auf dem Desktop PC)",
+ "Only_works_with_chrome_version_greater_50": "Funktioniert nur mit Chrome Browser Versionen > 50",
"Only_you_can_see_this_message": "Nur Du kannst diese Nachricht sehen",
"Oops!": "Hoppla",
"Oops_page_not_found": "Hoppla, Seite nicht gefunden",
diff --git a/packages/rocketchat-i18n/i18n/de.i18n.json b/packages/rocketchat-i18n/i18n/de.i18n.json
index 9fb099c0eb44a..be3992ce5251f 100644
--- a/packages/rocketchat-i18n/i18n/de.i18n.json
+++ b/packages/rocketchat-i18n/i18n/de.i18n.json
@@ -2221,6 +2221,8 @@
"Not_Imported_Messages_Title": "Der Import folgender Nachrichten schlug fehl",
"Notification_Desktop_Default_For": "Desktop-Benachrichtigungen anzeigen für",
"Notification_Duration": "Benachrichtigungsdauer",
+ "Notification_RequireInteraction": "Benutzerinteraktion notwendig um Benachrichtigung auszublenden",
+ "Notification_RequireInteraction_Description": "Verwendung nur mit Chrome Browser Version > 50 möglich. Verwendet den Parameter requireInteraction um die Anzeigedauer der Desktop-Benachrichtigung bis zur Benutzerinteraktion zu verlängern.",
"Notification_Mobile_Default_For": "Mobile Benachrichtigungen anzeigen für",
"Notifications": "Benachrichtigungen",
"Notifications_Always_Notify_Mobile": "Immer das Mobiltelefon benachrichtigen",
@@ -2267,6 +2269,7 @@
"Only_authorized_users_can_write_new_messages": "Nur Authentifizierte Benutzer können neue Nachrichten schreiben",
"Only_from_users": "Löscht nur den Inhalt dieser Benutzer (lassen Sie den Inhalt leer)",
"Only_On_Desktop": "Desktop Modus (senden mit der Eingabeaste nur auf dem Desktop PC)",
+ "Only_works_with_chrome_version_greater_50": "Funktioniert nur mit Chrome Browser Versionen > 50",
"Only_you_can_see_this_message": "Nur Sie können diese Nachricht sehen",
"Oops!": "Hoppla",
"Oops_page_not_found": "Hoppla, Seite nicht gefunden",
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index cd2f220aa6bfc..1d5a3e43f40ae 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -2280,6 +2280,8 @@
"Not_Imported_Messages_Title": "The following messages were not imported successfully",
"Notification_Desktop_Default_For": "Show Desktop Notifications For",
"Notification_Duration": "Notification Duration",
+ "Notification_RequireInteraction": "Require Interaction to Dismiss Desktop Notification",
+ "Notification_RequireInteraction_Description": "Works only with Chrome browser versions > 50. Utilizes the parameter requireInteraction to show the desktop notification to indefinite until the user interacts with it.",
"Notification_Mobile_Default_For": "Push Mobile Notifications For",
"Notifications": "Notifications",
"Notifications_Always_Notify_Mobile": "Always notify mobile",
@@ -2327,6 +2329,7 @@
"Only_authorized_users_can_write_new_messages": "Only authorized users can write new messages",
"Only_from_users": "Only prune content from these users (leave empty to prune everyone's content)",
"Only_On_Desktop": "Desktop mode (only sends with enter on desktop)",
+ "Only_works_with_chrome_version_greater_50": "Only works with Chrome browser versions > 50",
"Only_you_can_see_this_message": "Only you can see this message",
"Oops!": "Oops",
"Oops_page_not_found": "Oops, page not found",
diff --git a/tests/data/user.js b/tests/data/user.js
index 2dd53e7213290..eb89086973be8 100644
--- a/tests/data/user.js
+++ b/tests/data/user.js
@@ -24,6 +24,7 @@ export const preferences = {
enableAutoAway: true,
highlights: [],
desktopNotificationDuration: 0,
+ desktopNotificationRequireInteraction: false,
messageViewMode: 0,
hideUsernames: false,
hideRoles: false,
diff --git a/tests/end-to-end/api/00-miscellaneous.js b/tests/end-to-end/api/00-miscellaneous.js
index 3a6773fa2bac4..32fc0632192bb 100644
--- a/tests/end-to-end/api/00-miscellaneous.js
+++ b/tests/end-to-end/api/00-miscellaneous.js
@@ -125,6 +125,7 @@ describe('miscellaneous', function() {
'enableAutoAway',
// 'highlights',
'desktopNotificationDuration',
+ 'desktopNotificationRequireInteraction',
'messageViewMode',
'hideUsernames',
'hideRoles',