mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 05:06:53 +08:00
Removed invalid Action.notificationDismissed firing
Summary: If a notification is dismissed manually, the setInterval dismissal is still fired. This patch adds a check and removes the notification dismissal action from firing Test Plan: none Reviewers: ktalwar, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1218
This commit is contained in:
parent
af357ef005
commit
ac1ad67123
1 changed files with 5 additions and 1 deletions
|
@ -74,7 +74,8 @@ NotificationStore = Reflux.createStore
|
||||||
@_notifications[notification.tag] = notification
|
@_notifications[notification.tag] = notification
|
||||||
if notification.expiry?
|
if notification.expiry?
|
||||||
timeoutVal = Math.max(0, notification.expiry - Date.now())
|
timeoutVal = Math.max(0, notification.expiry - Date.now())
|
||||||
setTimeout(@_removeNotification(notification), timeoutVal)
|
timeoutId = setTimeout(@_removeNotification(notification), timeoutVal)
|
||||||
|
notification.timeoutId = timeoutId
|
||||||
|
|
||||||
@trigger()
|
@trigger()
|
||||||
|
|
||||||
|
@ -82,6 +83,9 @@ NotificationStore = Reflux.createStore
|
||||||
# above in setTimeout()
|
# above in setTimeout()
|
||||||
_removeNotification: (notification) -> =>
|
_removeNotification: (notification) -> =>
|
||||||
console.log "Removed #{notification}" if VERBOSE
|
console.log "Removed #{notification}" if VERBOSE
|
||||||
|
|
||||||
|
clearTimeout(notification.timeoutId) if notification.timeoutId
|
||||||
|
|
||||||
delete @_notifications[notification.tag]
|
delete @_notifications[notification.tag]
|
||||||
@trigger()
|
@trigger()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue