Echo 6308fcd9f8 [Glitch] Add more resilience to Emoji IDB upgrades
Port 1dc2abb9f5b430f80e771f214343983919cd543d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2026-06-24 17:30:07 +02:00

27 lines
885 B
JavaScript

import { Map as ImmutableMap } from 'immutable';
import { changeLayout, needsReload } from 'flavours/glitch/actions/app';
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
import { layoutFromWindow } from 'flavours/glitch/is_mobile';
const initialState = ImmutableMap({
streaming_api_base_url: null,
layout: layoutFromWindow(),
permissions: '0',
needsReload: false,
});
export default function meta(state = initialState, action) {
switch(action.type) {
case STORE_HYDRATE:
// we do not want `access_token` to be stored in the state
return state.merge(action.state.get('meta')).delete('access_token').set('permissions', action.state.getIn(['role', 'permissions']));
case changeLayout.type:
return state.set('layout', action.payload.layout);
case needsReload.type:
return state.set('needsReload', true);
default:
return state;
}
}