mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-25 01:24:02 -05:00
Add button to edit media description from missing description confirmation dialog
This commit is contained in:
parent
dff4ccd7e9
commit
fae9e34484
@ -121,7 +121,8 @@ 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'))) {
|
||||||
onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null);
|
const firstWithoutDescription = media.find(item => !item.get('description'));
|
||||||
|
onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id'));
|
||||||
} else if (onSubmit) {
|
} else if (onSubmit) {
|
||||||
onSubmit(this.context.router ? this.context.router.history : null);
|
onSubmit(this.context.router ? this.context.router.history : null);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ const messages = defineMessages({
|
|||||||
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
|
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
|
||||||
missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm',
|
missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm',
|
||||||
defaultMessage: 'Send anyway' },
|
defaultMessage: 'Send anyway' },
|
||||||
|
missingDescriptionEdit: { id: 'confirmations.missing_media_description.edit',
|
||||||
|
defaultMessage: 'Edit media' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// State mapping.
|
// State mapping.
|
||||||
@ -112,11 +114,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||||||
dispatch(changeComposeVisibility(value));
|
dispatch(changeComposeVisibility(value));
|
||||||
},
|
},
|
||||||
|
|
||||||
onMediaDescriptionConfirm(routerHistory) {
|
onMediaDescriptionConfirm(routerHistory, mediaId) {
|
||||||
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: () => dispatch(submitCompose(routerHistory)),
|
||||||
|
secondary: intl.formatMessage(messages.missingDescriptionEdit),
|
||||||
|
onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })),
|
||||||
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)),
|
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user