From 8389587a60c6c31bc2f56fb0f9528feb4989bc9a Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 31 Oct 2021 12:56:32 +0100 Subject: [PATCH] fix: check if notifications are available at all before checking if triggered are available Should fix sentry issue FRONTEND-OSS-J --- src/models/task.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/task.js b/src/models/task.js index 2b3a9f7c..d83f35a6 100644 --- a/src/models/task.js +++ b/src/models/task.js @@ -101,7 +101,7 @@ export default class TaskModel extends AbstractModel { index: 0, isFavorite: false, subscription: null, - + position: 0, kanbanPosition: 0, @@ -161,7 +161,7 @@ export default class TaskModel extends AbstractModel { } async cancelScheduledNotifications() { - if (!('showTrigger' in Notification.prototype)) { + if (!(Notification && 'showTrigger' in Notification.prototype)) { console.debug('This browser does not support triggered notifications') return } @@ -196,7 +196,7 @@ export default class TaskModel extends AbstractModel { return } - if (!('showTrigger' in Notification.prototype)) { + if (!(Notification && 'showTrigger' in Notification.prototype)) { console.debug('This browser does not support triggered notifications') return } @@ -231,7 +231,7 @@ export default class TaskModel extends AbstractModel { ], }) console.debug('Notification scheduled for ' + date) - } catch(e) { + } catch (e) { throw new Error('Error scheduling notification', e) } }