Merge pull request #1956 from thelounge/xpaw/fix-notif-timestamp
Provide correct timestamp to browser notifications
This commit is contained in:
commit
6cbc2eeef3
@ -149,13 +149,15 @@ function notifyMessage(targetId, channel, msg) {
|
|||||||
body = cleanIrcMessage(msg.text);
|
body = cleanIrcMessage(msg.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const timestamp = Date.parse(msg.time);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (webpush.hasServiceWorker) {
|
if (webpush.hasServiceWorker) {
|
||||||
navigator.serviceWorker.ready.then((registration) => {
|
navigator.serviceWorker.ready.then((registration) => {
|
||||||
registration.active.postMessage({
|
registration.active.postMessage({
|
||||||
type: "notification",
|
type: "notification",
|
||||||
chanId: targetId,
|
chanId: targetId,
|
||||||
timestamp: msg.time,
|
timestamp: timestamp,
|
||||||
title: title,
|
title: title,
|
||||||
body: body,
|
body: body,
|
||||||
});
|
});
|
||||||
@ -166,7 +168,7 @@ function notifyMessage(targetId, channel, msg) {
|
|||||||
badge: "img/logo-64.png",
|
badge: "img/logo-64.png",
|
||||||
icon: "img/touch-icon-192x192.png",
|
icon: "img/touch-icon-192x192.png",
|
||||||
body: body,
|
body: body,
|
||||||
timestamp: msg.time,
|
timestamp: timestamp,
|
||||||
});
|
});
|
||||||
notify.addEventListener("click", function() {
|
notify.addEventListener("click", function() {
|
||||||
window.focus();
|
window.focus();
|
||||||
|
Loading…
Reference in New Issue
Block a user