|
@ -6,6 +6,14 @@ import { |
|
|
FAVOURITED_STATUSES_EXPAND_SUCCESS, |
|
|
FAVOURITED_STATUSES_EXPAND_SUCCESS, |
|
|
FAVOURITED_STATUSES_EXPAND_FAIL, |
|
|
FAVOURITED_STATUSES_EXPAND_FAIL, |
|
|
} from 'flavours/glitch/actions/favourites'; |
|
|
} from 'flavours/glitch/actions/favourites'; |
|
|
|
|
|
import { |
|
|
|
|
|
BOOKMARKED_STATUSES_FETCH_REQUEST, |
|
|
|
|
|
BOOKMARKED_STATUSES_FETCH_SUCCESS, |
|
|
|
|
|
BOOKMARKED_STATUSES_FETCH_FAIL, |
|
|
|
|
|
BOOKMARKED_STATUSES_EXPAND_REQUEST, |
|
|
|
|
|
BOOKMARKED_STATUSES_EXPAND_SUCCESS, |
|
|
|
|
|
BOOKMARKED_STATUSES_EXPAND_FAIL, |
|
|
|
|
|
} from 'flavours/glitch/actions/bookmarks'; |
|
|
import { |
|
|
import { |
|
|
PINNED_STATUSES_FETCH_SUCCESS, |
|
|
PINNED_STATUSES_FETCH_SUCCESS, |
|
|
} from 'flavours/glitch/actions/pin_statuses'; |
|
|
} from 'flavours/glitch/actions/pin_statuses'; |
|
@ -13,6 +21,8 @@ import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; |
|
|
import { |
|
|
import { |
|
|
FAVOURITE_SUCCESS, |
|
|
FAVOURITE_SUCCESS, |
|
|
UNFAVOURITE_SUCCESS, |
|
|
UNFAVOURITE_SUCCESS, |
|
|
|
|
|
BOOKMARK_SUCCESS, |
|
|
|
|
|
UNBOOKMARK_SUCCESS, |
|
|
PIN_SUCCESS, |
|
|
PIN_SUCCESS, |
|
|
UNPIN_SUCCESS, |
|
|
UNPIN_SUCCESS, |
|
|
} from 'flavours/glitch/actions/interactions'; |
|
|
} from 'flavours/glitch/actions/interactions'; |
|
@ -23,6 +33,11 @@ const initialState = ImmutableMap({ |
|
|
loaded: false, |
|
|
loaded: false, |
|
|
items: ImmutableList(), |
|
|
items: ImmutableList(), |
|
|
}), |
|
|
}), |
|
|
|
|
|
bookmarks: ImmutableMap({ |
|
|
|
|
|
next: null, |
|
|
|
|
|
loaded: false, |
|
|
|
|
|
items: ImmutableList(), |
|
|
|
|
|
}), |
|
|
pins: ImmutableMap({ |
|
|
pins: ImmutableMap({ |
|
|
next: null, |
|
|
next: null, |
|
|
loaded: false, |
|
|
loaded: false, |
|
@ -71,10 +86,24 @@ export default function statusLists(state = initialState, action) { |
|
|
return normalizeList(state, 'favourites', action.statuses, action.next); |
|
|
return normalizeList(state, 'favourites', action.statuses, action.next); |
|
|
case FAVOURITED_STATUSES_EXPAND_SUCCESS: |
|
|
case FAVOURITED_STATUSES_EXPAND_SUCCESS: |
|
|
return appendToList(state, 'favourites', action.statuses, action.next); |
|
|
return appendToList(state, 'favourites', action.statuses, action.next); |
|
|
|
|
|
case BOOKMARKED_STATUSES_FETCH_REQUEST: |
|
|
|
|
|
case BOOKMARKED_STATUSES_EXPAND_REQUEST: |
|
|
|
|
|
return state.setIn(['bookmarks', 'isLoading'], true); |
|
|
|
|
|
case BOOKMARKED_STATUSES_FETCH_FAIL: |
|
|
|
|
|
case BOOKMARKED_STATUSES_EXPAND_FAIL: |
|
|
|
|
|
return state.setIn(['bookmarks', 'isLoading'], false); |
|
|
|
|
|
case BOOKMARKED_STATUSES_FETCH_SUCCESS: |
|
|
|
|
|
return normalizeList(state, 'bookmarks', action.statuses, action.next); |
|
|
|
|
|
case BOOKMARKED_STATUSES_EXPAND_SUCCESS: |
|
|
|
|
|
return appendToList(state, 'bookmarks', action.statuses, action.next); |
|
|
case FAVOURITE_SUCCESS: |
|
|
case FAVOURITE_SUCCESS: |
|
|
return prependOneToList(state, 'favourites', action.status); |
|
|
return prependOneToList(state, 'favourites', action.status); |
|
|
case UNFAVOURITE_SUCCESS: |
|
|
case UNFAVOURITE_SUCCESS: |
|
|
return removeOneFromList(state, 'favourites', action.status); |
|
|
return removeOneFromList(state, 'favourites', action.status); |
|
|
|
|
|
case BOOKMARK_SUCCESS: |
|
|
|
|
|
return prependOneToList(state, 'bookmarks', action.status); |
|
|
|
|
|
case UNBOOKMARK_SUCCESS: |
|
|
|
|
|
return removeOneFromList(state, 'bookmarks', action.status); |
|
|
case PINNED_STATUSES_FETCH_SUCCESS: |
|
|
case PINNED_STATUSES_FETCH_SUCCESS: |
|
|
return normalizeList(state, 'pins', action.statuses, action.next); |
|
|
return normalizeList(state, 'pins', action.statuses, action.next); |
|
|
case PIN_SUCCESS: |
|
|
case PIN_SUCCESS: |
|
|