Fix posting privacy on secondary button with missing description confirmation dialog

This commit is contained in:
Thibaut Girka 2020-03-14 12:04:55 +01:00 committed by ThibG
parent e53622442c
commit 531658d6cf
2 changed files with 8 additions and 3 deletions

View File

@ -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);

View File

@ -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)),