[Glitch] Fix composer route opening when not needed

Port c1e77b56a9 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
りんすき 2018-02-22 03:33:23 +09:00 committed by ThibG
parent fd0487c04f
commit fdb3952b20
1 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ const totalElefriends = 3;
const glitchProbability = 1 - 0.0420215528; const glitchProbability = 1 - 0.0420215528;
const initialState = ImmutableMap({ const initialState = ImmutableMap({
mounted: false, mounted: 0,
advanced_options: ImmutableMap({ advanced_options: ImmutableMap({
do_not_federate: false, do_not_federate: false,
threaded_mode: false, threaded_mode: false,
@ -280,9 +280,9 @@ export default function compose(state = initialState, action) {
case STORE_HYDRATE: case STORE_HYDRATE:
return hydrate(state, action.state.get('compose')); return hydrate(state, action.state.get('compose'));
case COMPOSE_MOUNT: case COMPOSE_MOUNT:
return state.set('mounted', true); return state.set('mounted', state.get('mounted') + 1);
case COMPOSE_UNMOUNT: case COMPOSE_UNMOUNT:
return state.set('mounted', false); return state.set('mounted', Math.max(state.get('mounted') - 1, 0));
case COMPOSE_ADVANCED_OPTIONS_CHANGE: case COMPOSE_ADVANCED_OPTIONS_CHANGE:
return state return state
.set('advanced_options', state.get('advanced_options').set(action.option, !!overwrite(!state.getIn(['advanced_options', action.option]), action.value))) .set('advanced_options', state.get('advanced_options').set(action.option, !!overwrite(!state.getIn(['advanced_options', action.option]), action.value)))