Add reminder when about to post without alt text in web UI (#33760)

This commit is contained in:
Eugen Rochko 2025-01-29 12:37:56 +01:00 committed by GitHub
parent 2beab34ca4
commit 1e70da5e3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 121 additions and 13 deletions

View file

@ -9,7 +9,9 @@ import {
changeComposeSpoilerText,
insertEmojiCompose,
uploadCompose,
} from '../../../actions/compose';
} from 'mastodon/actions/compose';
import { openModal } from 'mastodon/actions/modal';
import ComposeForm from '../components/compose_form';
const mapStateToProps = state => ({
@ -26,6 +28,7 @@ const mapStateToProps = state => ({
isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
isUploading: state.getIn(['compose', 'is_uploading']),
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
missingAltText: state.getIn(['compose', 'media_attachments']).some(media => ['image', 'gifv'].includes(media.get('type')) && (media.get('description') ?? '').length === 0),
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),
@ -37,8 +40,15 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(changeCompose(text));
},
onSubmit () {
dispatch(submitCompose());
onSubmit (missingAltText) {
if (missingAltText) {
dispatch(openModal({
modalType: 'CONFIRM_MISSING_ALT_TEXT',
modalProps: {},
}));
} else {
dispatch(submitCompose());
}
},
onClearSuggestions () {