mirror of https://github.com/tootsuite/mastodon
parent
da0333f1cb
commit
bb911043de
|
@ -60,12 +60,7 @@ const defaultColumns = Immutable.fromJS([
|
||||||
{ id: 'NOTIFICATIONS', uuid: uuid(), params: {} },
|
{ id: 'NOTIFICATIONS', uuid: uuid(), params: {} },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const hydrate = (settings) => {
|
const hydrate = (state, settings) => state.mergeDeep(settings).update('columns', (val = defaultColumns) => val);
|
||||||
return initialState.withMutations((state) => {
|
|
||||||
state.mergeDeep(settings);
|
|
||||||
state.update('columns', defaultColumns, val => val);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const moveColumn = (state, uuid, direction) => {
|
const moveColumn = (state, uuid, direction) => {
|
||||||
const columns = state.get('columns');
|
const columns = state.get('columns');
|
||||||
|
@ -83,7 +78,7 @@ const moveColumn = (state, uuid, direction) => {
|
||||||
export default function settings(state = initialState, action) {
|
export default function settings(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case STORE_HYDRATE:
|
case STORE_HYDRATE:
|
||||||
return hydrate(action.state.get('settings'));
|
return hydrate(state, action.state.get('settings'));
|
||||||
case SETTING_CHANGE:
|
case SETTING_CHANGE:
|
||||||
return state.setIn(action.key, action.value);
|
return state.setIn(action.key, action.value);
|
||||||
case COLUMN_ADD:
|
case COLUMN_ADD:
|
||||||
|
|
Loading…
Reference in New Issue