Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fix sticky notifications not working #18285

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Changes from all 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
6 changes: 3 additions & 3 deletions app/ui/client/lib/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated to the rest of the PR.

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);
}
Expand Down