@ -140,7 +140,7 @@ const appendNormalizedTimeline = (state, timeline, statuses, next) => {
return state . updateIn ( [ timeline , 'items' ] , Immutable . List ( ) , list => list . concat ( moreIds ) ) ;
return state . updateIn ( [ timeline , 'items' ] , Immutable . List ( ) , list => list . concat ( moreIds ) ) ;
} ;
} ;
const normalizeAccountTimeline = ( state , accountId , statuses , replace = false ) => {
const normalizeAccountTimeline = ( state , accountId , statuses , replace , next ) => {
let ids = Immutable . List ( ) ;
let ids = Immutable . List ( ) ;
statuses . forEach ( ( status , i ) => {
statuses . forEach ( ( status , i ) => {
@ -151,11 +151,11 @@ const normalizeAccountTimeline = (state, accountId, statuses, replace = false) =
return state . updateIn ( [ 'accounts_timelines' , accountId ] , Immutable . Map ( ) , map => map
return state . updateIn ( [ 'accounts_timelines' , accountId ] , Immutable . Map ( ) , map => map
. set ( 'isLoading' , false )
. set ( 'isLoading' , false )
. set ( 'loaded' , true )
. set ( 'loaded' , true )
. set ( 'next' , true )
. set ( 'next' , next )
. update ( 'items' , Immutable . List ( ) , list => ( replace ? ids : ids . concat ( list ) ) ) ) ;
. update ( 'items' , Immutable . List ( ) , list => ( replace ? ids : ids . concat ( list ) ) ) ) ;
} ;
} ;
const normalizeAccountMediaTimeline = ( state , accountId , statuses ) => {
const normalizeAccountMediaTimeline = ( state , accountId , statuses , replace , next ) => {
let ids = Immutable . List ( ) ;
let ids = Immutable . List ( ) ;
statuses . forEach ( ( status , i ) => {
statuses . forEach ( ( status , i ) => {
@ -165,8 +165,8 @@ const normalizeAccountMediaTimeline = (state, accountId, statuses) => {
return state . updateIn ( [ 'accounts_media_timelines' , accountId ] , Immutable . Map ( ) , map => map
return state . updateIn ( [ 'accounts_media_timelines' , accountId ] , Immutable . Map ( ) , map => map
. set ( 'isLoading' , false )
. set ( 'isLoading' , false )
. set ( 'next' , true )
. set ( 'next' , next )
. update ( 'items' , Immutable . List ( ) , list => ids . concat ( list ) ) ) ;
. update ( 'items' , Immutable . List ( ) , list => ( replace ? ids : ids . concat ( list ) ) ) ) ;
} ;
} ;
const appendNormalizedAccountTimeline = ( state , accountId , statuses , next ) => {
const appendNormalizedAccountTimeline = ( state , accountId , statuses , next ) => {
@ -335,7 +335,7 @@ export default function timelines(state = initialState, action) {
case ACCOUNT _TIMELINE _EXPAND _FAIL :
case ACCOUNT _TIMELINE _EXPAND _FAIL :
return state . updateIn ( [ 'accounts_timelines' , action . id ] , Immutable . Map ( ) , map => map . set ( 'isLoading' , false ) ) ;
return state . updateIn ( [ 'accounts_timelines' , action . id ] , Immutable . Map ( ) , map => map . set ( 'isLoading' , false ) ) ;
case ACCOUNT _TIMELINE _FETCH _SUCCESS :
case ACCOUNT _TIMELINE _FETCH _SUCCESS :
return normalizeAccountTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . replace ) ;
return normalizeAccountTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . replace , action . next ) ;
case ACCOUNT _TIMELINE _EXPAND _SUCCESS :
case ACCOUNT _TIMELINE _EXPAND _SUCCESS :
return appendNormalizedAccountTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . next ) ;
return appendNormalizedAccountTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . next ) ;
case ACCOUNT _MEDIA _TIMELINE _FETCH _REQUEST :
case ACCOUNT _MEDIA _TIMELINE _FETCH _REQUEST :
@ -345,7 +345,7 @@ export default function timelines(state = initialState, action) {
case ACCOUNT _MEDIA _TIMELINE _EXPAND _FAIL :
case ACCOUNT _MEDIA _TIMELINE _EXPAND _FAIL :
return state . updateIn ( [ 'accounts_media_timelines' , action . id ] , Immutable . Map ( ) , map => map . set ( 'isLoading' , false ) ) ;
return state . updateIn ( [ 'accounts_media_timelines' , action . id ] , Immutable . Map ( ) , map => map . set ( 'isLoading' , false ) ) ;
case ACCOUNT _MEDIA _TIMELINE _FETCH _SUCCESS :
case ACCOUNT _MEDIA _TIMELINE _FETCH _SUCCESS :
return normalizeAccountMediaTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) ) ;
return normalizeAccountMediaTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . replace , action . next ) ;
case ACCOUNT _MEDIA _TIMELINE _EXPAND _SUCCESS :
case ACCOUNT _MEDIA _TIMELINE _EXPAND _SUCCESS :
return appendNormalizedAccountMediaTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . next ) ;
return appendNormalizedAccountMediaTimeline ( state , action . id , Immutable . fromJS ( action . statuses ) , action . next ) ;
case ACCOUNT _BLOCK _SUCCESS :
case ACCOUNT _BLOCK _SUCCESS :