Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/api/server/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,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),
Expand Down
6 changes: 6 additions & 0 deletions app/lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
8 changes: 8 additions & 0 deletions app/ui-account/client/accountPreferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ <h1>{{_ "Notifications"}}</h1>
{{/if}}
</div>
</div>
<div class="input-line double-col" id="unreadAlert">
<label class="setting-label">{{_ "Notification_RequireInteraction"}}</label>
<div class="setting-field">
<label><input type="radio" name="desktopNotificationRequireInteraction" value="true" checked="{{checked 'desktopNotificationRequireInteraction' true}}"/> {{_ "On"}}</label>
<label><input type="radio" name="desktopNotificationRequireInteraction" value="false" checked="{{checked 'desktopNotificationRequireInteraction' false}}"/> {{_ "Off"}}</label>
<div class="settings-description secondary-font-color">{{_ "Only_works_with_chrome_version_greater_50"}}</div>
</div>
</div>
<div class="input-line double-col" id="desktopNotifications">
<label class="setting-label">{{_ "Notification_Desktop_Default_For"}}</label>
<div class="rc-select setting-field">
Expand Down
13 changes: 13 additions & 0 deletions app/ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},
Expand Down Expand Up @@ -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')) {
Expand Down
1 change: 1 addition & 0 deletions app/ui/client/lib/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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;
Expand Down
5 changes: 4 additions & 1 deletion packages/rocketchat-i18n/i18n/de-IN.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,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": "Desktop-Benachrichtigung nach Interaktion ausblenden",
"Notification_RequireInteraction_Description": "Verwendung nur mit Chrome Browser Version > 50 möglich. Verwendet den Parameter <i>requireInteraction</i> 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",
Expand Down Expand Up @@ -2200,6 +2202,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",
Expand Down Expand Up @@ -3246,4 +3249,4 @@
"Your_question": "Deine Frage",
"Your_server_link": "Dein Server-Link",
"Your_workspace_is_ready": "Dein Arbeitsbereich ist einsatzbereit 🎉"
}
}
5 changes: 4 additions & 1 deletion packages/rocketchat-i18n/i18n/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,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": "Benachrichtigung erst nach Benutzerinteraktion ausblenden",
"Notification_RequireInteraction_Description": "Verwendung nur mit Chrome Browser Version > 50 möglich. Verwendet den Parameter <i>requireInteraction</i> 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",
Expand Down Expand Up @@ -2210,6 +2212,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",
Expand Down Expand Up @@ -3259,4 +3262,4 @@
"Your_question": "Ihre Frage",
"Your_server_link": "Ihre Serververbindung",
"Your_workspace_is_ready": "Ihr Arbeitsbereich ist einsatzbereit 🎉"
}
}
3 changes: 3 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2179,6 +2179,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": "Close Desktop Notifications after user interaction",
Comment thread
mpdbl marked this conversation as resolved.
Outdated
"Notification_RequireInteraction_Description": "Works only with Chrome browser versions > 50. Utilizes the parameter <i>requireInteraction</i> 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",
Expand Down Expand Up @@ -2227,6 +2229,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",
Expand Down
1 change: 1 addition & 0 deletions tests/data/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const preferences = {
enableAutoAway: true,
highlights: [],
desktopNotificationDuration: 0,
desktopNotificationRequireInteraction: false,
messageViewMode: 0,
hideUsernames: false,
hideRoles: false,
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/api/00-miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe('miscellaneous', function() {
'enableAutoAway',
// 'highlights',
'desktopNotificationDuration',
'desktopNotificationRequireInteraction',
'messageViewMode',
'hideUsernames',
'hideRoles',
Expand Down