[FIX] Fix sticky notifications not working (#18285)

pull/18176/head^2
Guilherme Gazzo 5 years ago committed by GitHub
parent 1b31cb6a74
commit 02d69d0d6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/ui/client/lib/notification.js

@ -35,16 +35,16 @@ export const KonchatNotification = {
if (window.Notification && Notification.permission === 'granted') {
const message = { rid: notification.payload != null ? notification.payload.rid : undefined, msg: notification.text, notification: true };
return promises.run('onClientMessageReceived', message).then(function(message) {
const requireInteraction = getUserPreference(Meteor.userId(), 'desktopNotificationRequireInteraction');
const n = new Notification(notification.title, {
icon: notification.icon || getUserAvatarURL(notification.payload.sender.username),
body: s.stripTags(message.msg),
tag: notification.payload._id,
silent: true,
canReply: true,
requireInteraction: getUserPreference(Meteor.userId(), 'desktopNotificationRequireInteraction'),
requireInteraction,
});
const notificationDuration = notification.duration - 0 || 10;
const notificationDuration = !requireInteraction && (notification.duration - 0 || 10);
if (notificationDuration > 0) {
setTimeout(() => n.close(), notificationDuration * 1000);
}

Loading…
Cancel
Save