Skip to content

Commit 3583943

Browse files
GargronMage
authored andcommitted
Fix audio modals not using blurhash and poster (mastodon#14199)
1 parent e8c386f commit 3583943

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

app/javascript/mastodon/features/ui/components/audio_modal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export default class AudioModal extends ImmutablePureComponent {
5959
src={media.get('url')}
6060
alt={media.get('description')}
6161
duration={media.getIn(['meta', 'original', 'duration'], 0)}
62-
height={135}
63-
preload
62+
height={150}
63+
poster={media.get('preview_url') || status.getIn(['account', 'avatar_static'])}
64+
blurhash={media.get('blurhash')}
6465
/>
6566
</div>
6667

app/javascript/mastodon/features/ui/components/focal_point_modal.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import CharacterCounter from 'mastodon/features/compose/components/character_cou
1717
import { length } from 'stringz';
1818
import { Tesseract as fetchTesseract } from 'mastodon/features/ui/util/async-components';
1919
import GIFV from 'mastodon/components/gifv';
20+
import { me } from 'mastodon/initial_state';
2021

2122
const messages = defineMessages({
2223
close: { id: 'lightbox.close', defaultMessage: 'Close' },
@@ -26,6 +27,7 @@ const messages = defineMessages({
2627

2728
const mapStateToProps = (state, { id }) => ({
2829
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
30+
account: state.getIn(['accounts', me]),
2931
});
3032

3133
const mapDispatchToProps = (dispatch, { id }) => ({
@@ -78,6 +80,7 @@ class FocalPointModal extends ImmutablePureComponent {
7880

7981
static propTypes = {
8082
media: ImmutablePropTypes.map.isRequired,
83+
account: ImmutablePropTypes.map.isRequired,
8184
onClose: PropTypes.func.isRequired,
8285
intl: PropTypes.object.isRequired,
8386
};
@@ -233,7 +236,7 @@ class FocalPointModal extends ImmutablePureComponent {
233236
}
234237

235238
render () {
236-
const { media, intl, onClose } = this.props;
239+
const { media, intl, account, onClose } = this.props;
237240
const { x, y, dragging, description, dirty, detecting, progress } = this.state;
238241

239242
const width = media.getIn(['meta', 'original', 'width']) || null;
@@ -325,7 +328,8 @@ class FocalPointModal extends ImmutablePureComponent {
325328
src={media.get('url')}
326329
duration={media.getIn(['meta', 'original', 'duration'], 0)}
327330
height={150}
328-
preload
331+
poster={media.get('preview_url') || account.get('avatar_static')}
332+
blurhash={media.get('blurhash')}
329333
editable
330334
/>
331335
)}

0 commit comments

Comments
 (0)