From b48c7ee059d0e08fff4bdf7fe7b0e09565288252 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 20 Aug 2019 19:46:41 +0200 Subject: [PATCH 1/2] Fix handling of audio files in account media gallery (#11629) Fixes #11627 --- .../features/account_gallery/components/media_item.js | 6 ++++++ app/javascript/mastodon/features/account_gallery/index.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/mastodon/features/account_gallery/components/media_item.js index 2609b96ffca..d1b3c3bd492 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.js +++ b/app/javascript/mastodon/features/account_gallery/components/media_item.js @@ -96,6 +96,12 @@ export default class MediaItem extends ImmutablePureComponent { if (attachment.get('type') === 'unknown') { // Skip + } else if (attachment.get('type') === 'audio') { + thumbnail = ( + + + + ); } else if (attachment.get('type') === 'image') { const focusX = attachment.getIn(['meta', 'focus', 'x']) || 0; const focusY = attachment.getIn(['meta', 'focus', 'y']) || 0; diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.js index f1a665d8ff8..f3bf7a2bd63 100644 --- a/app/javascript/mastodon/features/account_gallery/index.js +++ b/app/javascript/mastodon/features/account_gallery/index.js @@ -100,7 +100,7 @@ class AccountGallery extends ImmutablePureComponent { } handleOpenMedia = attachment => { - if (attachment.get('type') === 'video') { + if (['video', 'audio'].includes(attachment.get('type'))) { this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') })); } else { const media = attachment.getIn(['status', 'media_attachments']); From f1528ea3c4b81dbc3f7bb8b5b5ae7734eeda989f Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 20 Aug 2019 19:46:41 +0200 Subject: [PATCH 2/2] [Glitch] Fix handling of audio files in account media gallery Port b48c7ee059d0e08fff4bdf7fe7b0e09565288252 to glitch-soc Signed-off-by: Thibaut Girka --- .../features/account_gallery/components/media_item.js | 6 ++++++ .../flavours/glitch/features/account_gallery/index.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js index 026136b2c2c..d60e0671522 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js +++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js @@ -94,6 +94,12 @@ export default class MediaItem extends ImmutablePureComponent { if (attachment.get('type') === 'unknown') { // Skip + } else if (attachment.get('type') === 'audio') { + thumbnail = ( + + + + ); } else if (attachment.get('type') === 'image') { const focusX = attachment.getIn(['meta', 'focus', 'x']) || 0; const focusY = attachment.getIn(['meta', 'focus', 'y']) || 0; diff --git a/app/javascript/flavours/glitch/features/account_gallery/index.js b/app/javascript/flavours/glitch/features/account_gallery/index.js index 3e44213067b..66b938bead8 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/index.js +++ b/app/javascript/flavours/glitch/features/account_gallery/index.js @@ -111,7 +111,7 @@ export default class AccountGallery extends ImmutablePureComponent { } handleOpenMedia = attachment => { - if (attachment.get('type') === 'video') { + if (['video', 'audio'].includes(attachment.get('type'))) { this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') })); } else { const media = attachment.getIn(['status', 'media_attachments']);