Page MenuHomePhabricator

D7329.id24944.diff
No OneTemporary

D7329.id24944.diff

diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js
--- a/web/push-notif/push-notifs-handler.js
+++ b/web/push-notif/push-notifs-handler.js
@@ -96,9 +96,11 @@
const dispatch = useDispatch();
+ const supported = 'Notification' in window && !electron;
+
React.useEffect(() => {
(async () => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -126,7 +128,7 @@
// Ask for permission on login
const prevLoggedIn = React.useRef(loggedIn);
React.useEffect(() => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -152,11 +154,12 @@
modalContext,
notifPermissionAlertInfo,
prevLoggedIn,
+ supported,
]);
// Redirect to thread on notification click
React.useEffect(() => {
- if (!navigator.serviceWorker || electron) {
+ if (!navigator.serviceWorker || !supported) {
return;
}
@@ -179,7 +182,7 @@
navigator.serviceWorker.addEventListener('message', callback);
return () =>
navigator.serviceWorker?.removeEventListener('message', callback);
- }, [dispatch]);
+ }, [dispatch, supported]);
return null;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:06 AM (25 m, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690273
Default Alt Text
D7329.id24944.diff (1 KB)

Event Timeline