Merge commit 'f826a95f6e' into kb_migration

This commit is contained in:
KMY 2023-07-25 15:09:10 +09:00
commit 4b65740722
211 changed files with 628 additions and 599 deletions

View file

@ -12,7 +12,7 @@ import { debounce } from 'lodash';
import { Blurhash } from 'mastodon/components/blurhash';
import { autoPlayGif, cropImages, displayMedia, displayMediaExpand, useBlurhash } from '../initial_state';
import { autoPlayGif, displayMedia, displayMediaExpand, useBlurhash } from '../initial_state';
import { IconButton } from './icon_button';
@ -225,7 +225,6 @@ class MediaGallery extends PureComponent {
static propTypes = {
sensitive: PropTypes.bool,
standalone: PropTypes.bool,
media: ImmutablePropTypes.list.isRequired,
lang: PropTypes.string,
size: PropTypes.object,
@ -239,10 +238,6 @@ class MediaGallery extends PureComponent {
onToggleVisibility: PropTypes.func,
};
static defaultProps = {
standalone: false,
};
state = {
visible: this.props.visible !== undefined ? this.props.visible : (displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all'),
width: this.props.defaultWidth,
@ -311,7 +306,7 @@ class MediaGallery extends PureComponent {
}
render () {
const { media, lang, intl, sensitive, defaultWidth, standalone, autoplay } = this.props;
const { media, lang, intl, sensitive, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const width = this.state.width || defaultWidth;
@ -319,10 +314,10 @@ class MediaGallery extends PureComponent {
const style = {};
if (this.isFullSizeEligible() && (standalone || !cropImages)) {
if (this.isFullSizeEligible()) {
style.aspectRatio = `${this.props.media.getIn([0, 'meta', 'small', 'aspect'])}`;
} else {
style.aspectRatio = '16 / 9';
style.aspectRatio = '3 / 2';
}
const maxSize = displayMediaExpand ? 16 : 4;
@ -330,7 +325,7 @@ class MediaGallery extends PureComponent {
const size = media.take(maxSize).size;
const uncached = media.every(attachment => attachment.get('type') === 'unknown');
if (standalone && this.isFullSizeEligible()) {
if (this.isFullSizeEligible()) {
children = <Item standalone autoplay={autoplay} onClick={this.handleClick} attachment={media.get(0)} lang={lang} displayWidth={width} visible={visible} />;
} else {
children = media.take(maxSize).map((attachment, i) => <Item key={attachment.get('id')} autoplay={autoplay} onClick={this.handleClick} attachment={attachment} index={i} lang={lang} size={size} displayWidth={width} visible={visible || uncached} />);