diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-07 22:17:52 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-08 01:00:14 +0100 |
commit | 6fe48dd050a84841c09bb1290a3e3cf99a795824 (patch) | |
tree | 6d7e860b5909d8c78c14b129766f88a7a9df9300 /app/javascript/flavours/glitch/reducers/timelines.js | |
parent | 5528719bc9fd4e8dca0e5e51de183a6dd27b4d55 (diff) |
[Glitch] Fix public timelines being broken by new toots when they are not mounted
Port be1c634b2b4372a525d304d2ff830392f04c5cc5 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/reducers/timelines.js')
-rw-r--r-- | app/javascript/flavours/glitch/reducers/timelines.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/reducers/timelines.js b/app/javascript/flavours/glitch/reducers/timelines.js index 4179cf477..ca71c3833 100644 --- a/app/javascript/flavours/glitch/reducers/timelines.js +++ b/app/javascript/flavours/glitch/reducers/timelines.js @@ -6,6 +6,7 @@ import { TIMELINE_EXPAND_REQUEST, TIMELINE_EXPAND_FAIL, TIMELINE_SCROLL_TOP, + TIMELINE_CONNECT, TIMELINE_DISCONNECT, } from 'flavours/glitch/actions/timelines'; import { @@ -20,6 +21,7 @@ const initialState = ImmutableMap(); const initialTimeline = ImmutableMap({ unread: 0, + online: false, top: true, isLoading: false, hasMore: true, @@ -137,14 +139,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; |