@ -14,6 +14,7 @@ import {
import {
ACCOUNT _BLOCK _SUCCESS ,
ACCOUNT _MUTE _SUCCESS ,
ACCOUNT _UNFOLLOW _SUCCESS ,
} from '../actions/accounts' ;
import { Map as ImmutableMap , List as ImmutableList , fromJS } from 'immutable' ;
@ -108,6 +109,12 @@ const filterTimelines = (state, relationship, statuses) => {
return state ;
} ;
const filterTimeline = ( timeline , state , relationship , statuses ) =>
state . updateIn ( [ timeline , 'items' ] , ImmutableList ( ) , list =>
list . filterNot ( statusId =>
statuses . getIn ( [ statusId , 'account' ] ) === relationship . id
) ) ;
const updateTop = ( state , timeline , top ) => {
return state . update ( timeline , initialTimeline , map => map . withMutations ( mMap => {
if ( top ) mMap . set ( 'unread' , 0 ) ;
@ -134,6 +141,8 @@ export default function timelines(state = initialState, action) {
case ACCOUNT _BLOCK _SUCCESS :
case ACCOUNT _MUTE _SUCCESS :
return filterTimelines ( state , action . relationship , action . statuses ) ;
case ACCOUNT _UNFOLLOW _SUCCESS :
return filterTimeline ( 'home' , state , action . relationship , action . statuses ) ;
case TIMELINE _SCROLL _TOP :
return updateTop ( state , action . timeline , action . top ) ;
case TIMELINE _CONNECT :