@@ -12,6 +12,7 @@ import {
1212 ACCOUNT_BLOCK_SUCCESS ,
1313 ACCOUNT_MUTE_SUCCESS ,
1414} from '../actions/accounts' ;
15+ import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks' ;
1516import { TIMELINE_DELETE , TIMELINE_DISCONNECT } from '../actions/timelines' ;
1617import { Map as ImmutableMap , List as ImmutableList } from 'immutable' ;
1718import compareId from '../compare_id' ;
@@ -83,8 +84,8 @@ const expandNormalizedNotifications = (state, notifications, next, usePendingIte
8384 } ) ;
8485} ;
8586
86- const filterNotifications = ( state , relationship ) => {
87- const helper = list => list . filterNot ( item => item !== null && item . get ( 'account' ) === relationship . id ) ;
87+ const filterNotifications = ( state , accountIds ) => {
88+ const helper = list => list . filterNot ( item => item !== null && accountIds . includes ( item . get ( 'account' ) ) ) ;
8889 return state . update ( 'items' , helper ) . update ( 'pendingItems' , helper ) ;
8990} ;
9091
@@ -118,9 +119,11 @@ export default function notifications(state = initialState, action) {
118119 case NOTIFICATIONS_EXPAND_SUCCESS :
119120 return expandNormalizedNotifications ( state , action . notifications , action . next , action . usePendingItems ) ;
120121 case ACCOUNT_BLOCK_SUCCESS :
121- return filterNotifications ( state , action . relationship ) ;
122+ return filterNotifications ( state , [ action . relationship . id ] ) ;
122123 case ACCOUNT_MUTE_SUCCESS :
123- return action . relationship . muting_notifications ? filterNotifications ( state , action . relationship ) : state ;
124+ return action . relationship . muting_notifications ? filterNotifications ( state , [ action . relationship . id ] ) : state ;
125+ case DOMAIN_BLOCK_SUCCESS :
126+ return filterNotifications ( state , action . accounts ) ;
124127 case NOTIFICATIONS_CLEAR :
125128 return state . set ( 'items' , ImmutableList ( ) ) . set ( 'pendingItems' , ImmutableList ( ) ) . set ( 'hasMore' , false ) ;
126129 case TIMELINE_DELETE :
0 commit comments