0
0
Fork 0

Fix public timelines being broken by new toots when they are not mounted (#10131)

This commit is contained in:
Eugen Rochko 2019-03-07 22:17:52 +01:00 committed by GitHub
parent 09c042aa10
commit be1c634b2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 7 deletions

View file

@ -6,6 +6,7 @@ import {
TIMELINE_EXPAND_REQUEST,
TIMELINE_EXPAND_FAIL,
TIMELINE_SCROLL_TOP,
TIMELINE_CONNECT,
TIMELINE_DISCONNECT,
} from '../actions/timelines';
import {
@ -20,6 +21,7 @@ const initialState = ImmutableMap();
const initialTimeline = ImmutableMap({
unread: 0,
online: false,
top: true,
isLoading: false,
hasMore: true,
@ -142,14 +144,13 @@ export default function timelines(state = initialState, action) {
return filterTimeline('home', state, action.relationship, action.statuses);
case TIMELINE_SCROLL_TOP:
return updateTop(state, action.timeline, action.top);
case TIMELINE_CONNECT:
return state.update(action.timeline, initialTimeline, map => map.set('online', true));
case TIMELINE_DISCONNECT:
return state.update(
action.timeline,
initialTimeline,
map => map.update(
'items',
items => items.first() ? items.unshift(null) : items
)
map => map.set('online', false).update('items', items => items.first() ? items.unshift(null) : items)
);
default:
return state;