pleroma/app/soapbox/reducers/meta.js

22 lines
564 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
'use strict';
import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS } from 'soapbox/actions/me';
import { Map as ImmutableMap, fromJS } from 'immutable';
2020-03-27 13:59:38 -07:00
const initialState = ImmutableMap();
2020-03-27 13:59:38 -07:00
export default function meta(state = initialState, action) {
switch(action.type) {
case ME_FETCH_SUCCESS:
case ME_PATCH_SUCCESS:
const me = fromJS(action.me);
2020-04-23 09:42:56 -07:00
if (me.has('pleroma')) {
const pleroPrefs = me.get('pleroma').delete('settings_store');
return state.mergeIn(['pleroma'], pleroPrefs);
}
return state;
2020-03-27 13:59:38 -07:00
default:
return state;
}
};