diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-03-14 12:04:55 +0100 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2020-03-14 12:33:50 +0100 |
commit | 531658d6cfbac3277ee3bf306683126f2c585719 (patch) | |
tree | 37c22c92695bc25a883852b6fe765cf14d010853 /app/javascript/flavours | |
parent | e53622442c17a6249a3dfb073b7cf4648c5ae59c (diff) |
Fix posting privacy on secondary button with missing description confirmation dialog
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/compose_form.js | 2 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index daacbb73f..0cf633358 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -123,7 +123,7 @@ class ComposeForm extends ImmutablePureComponent { // Submit unless there are media with missing descriptions if (mediaDescriptionConfirmation && onMediaDescriptionConfirm && media && media.some(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) { if (onChangeVisibility && overriddenVisibility) { onChangeVisibility(overriddenVisibility); diff --git a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js index 18e2b2f39..fcd2caf1b 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js @@ -114,11 +114,16 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(changeComposeVisibility(value)); }, - onMediaDescriptionConfirm(routerHistory, mediaId) { + onMediaDescriptionConfirm(routerHistory, mediaId, overriddenVisibility = null) { dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.missingDescriptionMessage), confirm: intl.formatMessage(messages.missingDescriptionConfirm), - onConfirm: () => dispatch(submitCompose(routerHistory)), + onConfirm: () => { + if (overriddenVisibility) { + dispatch(changeComposeVisibility(overriddenVisibility)); + }; + dispatch(submitCompose(routerHistory)); + }, secondary: intl.formatMessage(messages.missingDescriptionEdit), onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)), |