Fix posting privacy on secondary button with missing description confirmation dialog

th-downstream
Thibaut Girka 5 years ago committed by ThibG
parent 9af4ed237c
commit 03309b0dc5

@ -123,7 +123,7 @@ class ComposeForm extends ImmutablePureComponent {
// Submit unless there are media with missing descriptions // Submit unless there are media with missing descriptions
if (mediaDescriptionConfirmation && onMediaDescriptionConfirm && media && media.some(item => !item.get('description'))) { if (mediaDescriptionConfirmation && onMediaDescriptionConfirm && media && media.some(item => !item.get('description'))) {
const firstWithoutDescription = media.find(item => !item.get('description')); const firstWithoutDescription = media.find(item => !item.get('description'));
onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id')); onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id'), overriddenVisibility);
} else if (onSubmit) { } else if (onSubmit) {
if (onChangeVisibility && overriddenVisibility) { if (onChangeVisibility && overriddenVisibility) {
onChangeVisibility(overriddenVisibility); onChangeVisibility(overriddenVisibility);

@ -114,11 +114,16 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(changeComposeVisibility(value)); dispatch(changeComposeVisibility(value));
}, },
onMediaDescriptionConfirm(routerHistory, mediaId) { onMediaDescriptionConfirm(routerHistory, mediaId, overriddenVisibility = null) {
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.missingDescriptionMessage), message: intl.formatMessage(messages.missingDescriptionMessage),
confirm: intl.formatMessage(messages.missingDescriptionConfirm), confirm: intl.formatMessage(messages.missingDescriptionConfirm),
onConfirm: () => dispatch(submitCompose(routerHistory)), onConfirm: () => {
if (overriddenVisibility) {
dispatch(changeComposeVisibility(overriddenVisibility));
};
dispatch(submitCompose(routerHistory));
},
secondary: intl.formatMessage(messages.missingDescriptionEdit), secondary: intl.formatMessage(messages.missingDescriptionEdit),
onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })), onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })),
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)),

Loading…
Cancel
Save