Merge branch 'bug-fix-missing-service-worker' into 'master'

Don't show webpush section if navigator.serviceWorker is undefined

Closes #740

See merge request framasoft/mobilizon!967
This commit is contained in:
Thomas Citharel 2021-06-29 13:40:29 +00:00
commit 2f0eac4654

View file

@ -686,7 +686,7 @@ export default class Notifications extends Vue {
}
async checkCanShowWebPush(): Promise<boolean> {
if (!window.isSecureContext && !("serviceWorker" in navigator))
if (!window.isSecureContext || !("serviceWorker" in navigator))
return Promise.resolve(false);
const registration = await navigator.serviceWorker.getRegistration();
return registration !== undefined;