From: Dessalines Date: Wed, 21 Sep 2022 14:16:54 +0000 (-0400) Subject: Merge branch 'fix/notif_new_fetch_bug' of https://github.com/ernestwisniewski/lemmy... X-Git-Url: http://these/git/readmes/%7B%60%24%7BarchiveTodayUrl%7D/?a=commitdiff_plain;h=cc90ded31ed5d7d1b61474872481824113f0933b;p=lemmy-ui.git Merge branch 'fix/notif_new_fetch_bug' of https://github.com/ernestwisniewski/lemmy-ui into notif_bug --- cc90ded31ed5d7d1b61474872481824113f0933b diff --cc src/shared/utils.ts index 9257a4e,f9c554f..695ba1e --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@@ -630,21 -686,18 +630,18 @@@ export function notifyPrivateMessage(pm 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 && {icon: info.icon}) ++ ...{ 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() {