Fix being unable to unmark media as sensitive when "always mark media as sensitive" is enabled (#39339)
This commit is contained in:
parent
c51eb56a90
commit
f2094164c4
@ -220,7 +220,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();
|
||||
|
||||
@ -155,6 +155,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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -400,7 +404,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'));
|
||||
}
|
||||
});
|
||||
@ -545,7 +549,7 @@ export const composeReducer = (state = initialState, action) => {
|
||||
map.set('spoiler', true);
|
||||
map.set('spoiler_text', action.status.get('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', '');
|
||||
}
|
||||
|
||||
@ -582,7 +586,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