[Glitch] Fix being unable to unmark media as sensitive when "always mark media as sensitive" is enabled
Port f2094164c4046822dc455ae56f8d1847e88dc129 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
89c2ac444f
commit
318d82d0bb
@ -242,7 +242,9 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
} else if(prevProps.isSubmitting && !this.props.isSubmitting) {
|
||||
this.textareaRef.current.focus();
|
||||
} else if (this.props.spoiler !== prevProps.spoiler) {
|
||||
if (this.props.spoiler) {
|
||||
const mediaJustAdded = this.props.anyMedia && !prevProps.anyMedia;
|
||||
|
||||
if (this.props.spoiler && !mediaJustAdded) {
|
||||
this.spoilerText.input.focus();
|
||||
} else if (prevProps.spoiler) {
|
||||
this.textareaRef.current.focus();
|
||||
|
||||
@ -237,6 +237,10 @@ function appendMedia(state, media, file) {
|
||||
|
||||
if (prevSize === 0 && (state.get('default_sensitive') || state.get('spoiler'))) {
|
||||
map.set('sensitive', true);
|
||||
|
||||
if (state.get('default_sensitive')) {
|
||||
map.set('spoiler', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -483,7 +487,7 @@ export const composeReducer = (state = initialState, action) => {
|
||||
map.set('spoiler', !state.get('spoiler'));
|
||||
map.set('idempotencyKey', uuid());
|
||||
|
||||
if (state.get('media_attachments').size >= 1 && !state.get('default_sensitive')) {
|
||||
if (state.get('media_attachments').size >= 1) {
|
||||
map.set('sensitive', !state.get('spoiler'));
|
||||
}
|
||||
});
|
||||
@ -665,7 +669,7 @@ export const composeReducer = (state = initialState, action) => {
|
||||
map.set('sensitive', true);
|
||||
}
|
||||
} else {
|
||||
map.set('spoiler', false);
|
||||
map.set('spoiler', action.status.get('sensitive') && action.status.get('media_attachments').size > 0);
|
||||
map.set('spoiler_text', '');
|
||||
}
|
||||
|
||||
@ -704,7 +708,7 @@ export const composeReducer = (state = initialState, action) => {
|
||||
map.set('spoiler', true);
|
||||
map.set('spoiler_text', action.spoiler_text);
|
||||
} else {
|
||||
map.set('spoiler', false);
|
||||
map.set('spoiler', action.status.get('sensitive') && action.status.get('media_attachments').size > 0);
|
||||
map.set('spoiler_text', '');
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user