Fix UI crash in moderation interface when opening the media modal (#24816)
This commit is contained in:
parent
a610a02d4f
commit
5241f7b2fd
10 changed files with 39 additions and 38 deletions
|
@ -3,7 +3,6 @@ import ReactSwipeableViews from 'react-swipeable-views';
|
|||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import PropTypes from 'prop-types';
|
||||
import Video from 'mastodon/features/video';
|
||||
import { connect } from 'react-redux';
|
||||
import classNames from 'classnames';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { IconButton } from 'mastodon/components/icon_button';
|
||||
|
@ -21,15 +20,12 @@ const messages = defineMessages({
|
|||
next: { id: 'lightbox.next', defaultMessage: 'Next' },
|
||||
});
|
||||
|
||||
const mapStateToProps = (state, { statusId }) => ({
|
||||
language: state.getIn(['statuses', statusId, 'language']),
|
||||
});
|
||||
|
||||
class MediaModal extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
media: ImmutablePropTypes.list.isRequired,
|
||||
statusId: PropTypes.string,
|
||||
lang: PropTypes.string,
|
||||
index: PropTypes.number.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
|
@ -133,7 +129,7 @@ class MediaModal extends ImmutablePureComponent {
|
|||
};
|
||||
|
||||
render () {
|
||||
const { media, language, statusId, intl, onClose } = this.props;
|
||||
const { media, statusId, lang, intl, onClose } = this.props;
|
||||
const { navigationHidden } = this.state;
|
||||
|
||||
const index = this.getIndex();
|
||||
|
@ -153,7 +149,7 @@ class MediaModal extends ImmutablePureComponent {
|
|||
width={width}
|
||||
height={height}
|
||||
alt={image.get('description')}
|
||||
lang={language}
|
||||
lang={lang}
|
||||
key={image.get('url')}
|
||||
onClick={this.toggleNavigation}
|
||||
zoomButtonHidden={this.state.zoomButtonHidden}
|
||||
|
@ -176,7 +172,7 @@ class MediaModal extends ImmutablePureComponent {
|
|||
onCloseVideo={onClose}
|
||||
detailed
|
||||
alt={image.get('description')}
|
||||
lang={language}
|
||||
lang={lang}
|
||||
key={image.get('url')}
|
||||
/>
|
||||
);
|
||||
|
@ -188,7 +184,7 @@ class MediaModal extends ImmutablePureComponent {
|
|||
height={height}
|
||||
key={image.get('url')}
|
||||
alt={image.get('description')}
|
||||
lang={language}
|
||||
lang={lang}
|
||||
onClick={this.toggleNavigation}
|
||||
/>
|
||||
);
|
||||
|
@ -256,4 +252,4 @@ class MediaModal extends ImmutablePureComponent {
|
|||
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null, null, { forwardRef: true })(injectIntl(MediaModal));
|
||||
export default injectIntl(MediaModal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue