Handling new api structure with client-triggered broadcasts
This commit is contained in:
@ -203,10 +203,11 @@ export function closeNotification(key){
|
||||
}
|
||||
}
|
||||
|
||||
export function removeNotification(key){
|
||||
export function removeNotification(key, manual = false){
|
||||
return {
|
||||
type: 'REMOVE_NOTIFICATION',
|
||||
key: key
|
||||
key: key,
|
||||
manual: manual
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -86,14 +86,6 @@ const UIMiddleware = (function(){
|
||||
case 'CLOSE_NOTIFICATION':
|
||||
var notifications = Object.assign({}, store.getState().ui.notifications);
|
||||
|
||||
// If a broadcast, add to suppressed_broadcasts
|
||||
if (notifications[action.key] && notifications[action.key].type == 'broadcast'){
|
||||
store.dispatch({
|
||||
type: 'SUPPRESS_BROADCAST',
|
||||
key: action.key
|
||||
})
|
||||
}
|
||||
|
||||
// start a timeout to remove this notification
|
||||
// This gives us time to animate out the notification before we remove the data
|
||||
var timeout = setTimeout(
|
||||
@ -106,6 +98,24 @@ const UIMiddleware = (function(){
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'REMOVE_NOTIFICATION':
|
||||
|
||||
// Manual removal
|
||||
if (action.manual){
|
||||
var notifications = Object.assign({}, store.getState().ui.notifications);
|
||||
|
||||
// If a broadcast, add to suppressed_broadcasts
|
||||
if (notifications[action.key] && notifications[action.key].type == 'broadcast'){
|
||||
store.dispatch({
|
||||
type: 'SUPPRESS_BROADCAST',
|
||||
key: action.key
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'BROADCASTS_LOADED':
|
||||
var suppressed_broadcasts = []
|
||||
if (typeof(store.getState().ui.suppressed_broadcasts) !== 'undefined'){
|
||||
|
||||
Reference in New Issue
Block a user