Add lang attribute to media and poll options (#23891)

This commit is contained in:
Christian Schmidt 2023-02-26 20:13:27 +01:00 committed by GitHub
parent 730bb3e211
commit d3eefead30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 79 additions and 24 deletions

View file

@ -7,15 +7,17 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import Footer from 'mastodon/features/picture_in_picture/components/footer';
const mapStateToProps = (state, { statusId }) => ({
language: state.getIn(['statuses', statusId, 'language']),
accountStaticAvatar: state.getIn(['accounts', state.getIn(['statuses', statusId, 'account']), 'avatar_static']),
});
export default @connect(mapStateToProps)
export default @connect(mapStateToProps, null, null, { forwardRef: true })
class AudioModal extends ImmutablePureComponent {
static propTypes = {
media: ImmutablePropTypes.map.isRequired,
statusId: PropTypes.string.isRequired,
language: PropTypes.string,
accountStaticAvatar: PropTypes.string.isRequired,
options: PropTypes.shape({
autoPlay: PropTypes.bool,
@ -25,7 +27,7 @@ class AudioModal extends ImmutablePureComponent {
};
render () {
const { media, accountStaticAvatar, statusId, onClose } = this.props;
const { media, language, accountStaticAvatar, statusId, onClose } = this.props;
const options = this.props.options || {};
return (
@ -34,6 +36,7 @@ class AudioModal extends ImmutablePureComponent {
<Audio
src={media.get('url')}
alt={media.get('description')}
lang={language}
duration={media.getIn(['meta', 'original', 'duration'], 0)}
height={150}
poster={media.get('preview_url') || accountStaticAvatar}