From 2e7aac793ace0e938e45cb54ff601afa5d872214 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 13 Sep 2016 02:24:40 +0200 Subject: Adding sense of self to the UI, cleaning up routing, adding third (detail) column --- app/assets/javascripts/components/reducers/timelines.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/components/reducers') diff --git a/app/assets/javascripts/components/reducers/timelines.jsx b/app/assets/javascripts/components/reducers/timelines.jsx index b6ecdfb1f..24adeccf8 100644 --- a/app/assets/javascripts/components/reducers/timelines.jsx +++ b/app/assets/javascripts/components/reducers/timelines.jsx @@ -1,12 +1,14 @@ import { TIMELINE_SET, TIMELINE_UPDATE, TIMELINE_DELETE } from '../actions/timelines'; import { REBLOG_SUCCESS, FAVOURITE_SUCCESS } from '../actions/interactions'; +import { ACCOUNT_SET_SELF } from '../actions/accounts'; import Immutable from 'immutable'; const initialState = Immutable.Map({ home: Immutable.List([]), mentions: Immutable.List([]), statuses: Immutable.Map(), - accounts: Immutable.Map() + accounts: Immutable.Map(), + me: null }); function statusToMaps(state, status) { @@ -63,6 +65,11 @@ export default function timelines(state = initialState, action) { case REBLOG_SUCCESS: case FAVOURITE_SUCCESS: return statusToMaps(state, Immutable.fromJS(action.response)); + case ACCOUNT_SET_SELF: + return state.withMutations(map => { + map.setIn(['accounts', action.account.id], Immutable.fromJS(action.account)); + map.set('me', action.account.id); + }); default: return state; } -- cgit