Skip to content

Commit

Permalink
Merge branch 'fix/notif_new_fetch_bug' of https://github.com/ernestwi…
Browse files Browse the repository at this point in the history
…sniewski/lemmy-ui into notif_bug
  • Loading branch information
dessalines committed Sep 21, 2022
2 parents 035739f + 982fae5 commit cc90ded
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,21 +630,18 @@ export function notifyPrivateMessage(pmv: PrivateMessageView, router: any) {
function notify(info: NotifyInfo, router: any) {
messageToastify(info, router);

// TODO absolute nightmare bug, but notifs are currently broken.
// Notification.new will try to do a browser fetch ???

// if (Notification.permission !== "granted") Notification.requestPermission();
// else {
// var notification = new Notification(info.name, {
// icon: info.icon,
// body: info.body,
// });

// notification.onclick = (ev: Event): any => {
// ev.preventDefault();
// router.history.push(info.link);
// };
// }
if (Notification.permission !== "granted") Notification.requestPermission();
else {
var notification = new Notification(info.name, {
...{ body: info.body },
...(info.icon.isSome() && { icon: info.icon.unwrap() }),
});

notification.onclick = (ev: Event): any => {
ev.preventDefault();
router.history.push(info.link);
};
}
}

export function setupTribute() {
Expand Down

0 comments on commit cc90ded

Please sign in to comment.