fix: check if notifications are available at all before checking if triggered are available
All checks were successful
continuous-integration/drone/push Build is passing

Should fix sentry issue FRONTEND-OSS-J
This commit is contained in:
kolaente 2021-10-31 12:56:32 +01:00
parent 8bbdbe62a4
commit 8389587a60
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -101,7 +101,7 @@ export default class TaskModel extends AbstractModel {
index: 0, index: 0,
isFavorite: false, isFavorite: false,
subscription: null, subscription: null,
position: 0, position: 0,
kanbanPosition: 0, kanbanPosition: 0,
@ -161,7 +161,7 @@ export default class TaskModel extends AbstractModel {
} }
async cancelScheduledNotifications() { async cancelScheduledNotifications() {
if (!('showTrigger' in Notification.prototype)) { if (!(Notification && 'showTrigger' in Notification.prototype)) {
console.debug('This browser does not support triggered notifications') console.debug('This browser does not support triggered notifications')
return return
} }
@ -196,7 +196,7 @@ export default class TaskModel extends AbstractModel {
return return
} }
if (!('showTrigger' in Notification.prototype)) { if (!(Notification && 'showTrigger' in Notification.prototype)) {
console.debug('This browser does not support triggered notifications') console.debug('This browser does not support triggered notifications')
return return
} }
@ -231,7 +231,7 @@ export default class TaskModel extends AbstractModel {
], ],
}) })
console.debug('Notification scheduled for ' + date) console.debug('Notification scheduled for ' + date)
} catch(e) { } catch (e) {
throw new Error('Error scheduling notification', e) throw new Error('Error scheduling notification', e)
} }
} }