[Glitch] Fix notification permissions being requested immediately after login
Port f5f4f40955
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
parent
082e969b4f
commit
f0714c8106
|
@ -18,6 +18,7 @@ import {
|
|||
importFetchedStatuses,
|
||||
} from './importer';
|
||||
import { submitMarkers } from './markers';
|
||||
import { register as registerPushNotifications } from './push_notifications';
|
||||
import { saveSettings } from './settings';
|
||||
|
||||
|
||||
|
@ -384,6 +385,10 @@ export function requestBrowserPermission(callback = noOp) {
|
|||
requestNotificationPermission((permission) => {
|
||||
dispatch(setBrowserPermission(permission));
|
||||
callback(permission);
|
||||
|
||||
if (permission === 'granted') {
|
||||
dispatch(registerPushNotifications());
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ function main() {
|
|||
console.error(err);
|
||||
}
|
||||
|
||||
if (registration) {
|
||||
if (registration && 'Notification' in window && Notification.permission === 'granted') {
|
||||
const registerPushNotifications = await import('flavours/glitch/actions/push_notifications');
|
||||
|
||||
store.dispatch(registerPushNotifications.register());
|
||||
|
|
Loading…
Reference in New Issue