From a3d1287ce8e8082acaa9cc2db1c3cc91181bfa76 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 11 Jan 2016 10:56:17 -0800 Subject: [PATCH] fix(notifications): Fix notification removal [Sentry 8957] --- .../notifications/lib/notifications-store.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal_packages/notifications/lib/notifications-store.coffee b/internal_packages/notifications/lib/notifications-store.coffee index 05b703de8..6b17c41d9 100644 --- a/internal_packages/notifications/lib/notifications-store.coffee +++ b/internal_packages/notifications/lib/notifications-store.coffee @@ -44,7 +44,7 @@ NotificationStore = Reflux.createStore # your package should listen to notificationActionTaken and check the # notification and action objects. @listenTo Actions.notificationActionTaken, ({notification, action}) => - @_removeNotification(notification)() if action.dismisses + @_removeNotification(notification) if action.dismisses @listenTo Actions.postNotification, (data) => @_postNotification(new Notification(data)) @listenTo Actions.dismissNotificationsMatching, (criteria) => @@ -75,14 +75,16 @@ NotificationStore = Reflux.createStore @_notifications[notification.tag] = notification if notification.expiry? timeoutVal = Math.max(0, notification.expiry - Date.now()) - timeoutId = setTimeout(@_removeNotification(notification), timeoutVal) + timeoutId = setTimeout => + @_removeNotification(notification) + , timeoutVal notification.timeoutId = timeoutId @trigger() # Returns a function for removing a particular notification. See usage # above in setTimeout() - _removeNotification: (notification) -> => + _removeNotification: (notification) => console.log "Removed #{notification}" if VERBOSE clearTimeout(notification.timeoutId) if notification.timeoutId