mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 08:19:05 +00:00
[Glitch] fix: Keep user on Compose page when changing screen size, #34937
Port 6166e61638 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -79,6 +79,7 @@ const initialState = ImmutableMap({
|
||||
is_submitting: false,
|
||||
is_changing_upload: false,
|
||||
is_uploading: false,
|
||||
should_redirect_to_compose_page: false,
|
||||
progress: 0,
|
||||
isUploadingThumbnail: false,
|
||||
thumbnailProgress: 0,
|
||||
@@ -398,11 +399,21 @@ export const composeReducer = (state = initialState, action) => {
|
||||
case STORE_HYDRATE:
|
||||
return hydrate(state, action.state.get('compose'));
|
||||
case COMPOSE_MOUNT:
|
||||
return state.set('mounted', state.get('mounted') + 1);
|
||||
return state
|
||||
.set('mounted', state.get('mounted') + 1)
|
||||
.set('should_redirect_to_compose_page', false);
|
||||
case COMPOSE_UNMOUNT:
|
||||
return state
|
||||
.set('mounted', Math.max(state.get('mounted') - 1, 0))
|
||||
.set('is_composing', false);
|
||||
.set('is_composing', false)
|
||||
.set(
|
||||
'should_redirect_to_compose_page',
|
||||
(state.get('mounted') === 1 &&
|
||||
state.get('is_composing') === true &&
|
||||
(state.get('text').trim() !== '' ||
|
||||
state.get('media_attachments').size > 0)
|
||||
)
|
||||
);
|
||||
case COMPOSE_ADVANCED_OPTIONS_CHANGE:
|
||||
return state
|
||||
.set('advanced_options', state.get('advanced_options').set(action.option, !!overwrite(!state.getIn(['advanced_options', action.option]), action.value)))
|
||||
|
||||
Reference in New Issue
Block a user