From 1461cc53ed84b6b0e10762a5a705558dd8a9953c Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Thu, 3 Aug 2023 15:41:51 +0200 Subject: [PATCH] [Glitch] Add alt text for preview card thumbnails Port 8da99ffb0dcf5012179e4142799ff473910f5a66 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/features/explore/components/story.jsx | 5 +++-- app/javascript/flavours/glitch/features/explore/links.jsx | 1 + .../flavours/glitch/features/status/components/card.jsx | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 9a4a221bca..8dc92a4d91 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -23,6 +23,7 @@ export default class Story extends PureComponent { author: PropTypes.string, sharedTimes: PropTypes.number, thumbnail: PropTypes.string, + thumbnailDescription: PropTypes.string, blurhash: PropTypes.string, expanded: PropTypes.bool, }; @@ -34,7 +35,7 @@ export default class Story extends PureComponent { handleImageLoad = () => this.setState({ thumbnailLoaded: true }); render () { - const { expanded, url, title, lang, publisher, author, publishedAt, sharedTimes, thumbnail, blurhash } = this.props; + const { expanded, url, title, lang, publisher, author, publishedAt, sharedTimes, thumbnail, thumbnailDescription, blurhash } = this.props; const { thumbnailLoaded } = this.state; @@ -50,7 +51,7 @@ export default class Story extends PureComponent { {thumbnail ? ( <>
- + {thumbnailDescription} ) : } diff --git a/app/javascript/flavours/glitch/features/explore/links.jsx b/app/javascript/flavours/glitch/features/explore/links.jsx index 383f68a8b4..9124285f4f 100644 --- a/app/javascript/flavours/glitch/features/explore/links.jsx +++ b/app/javascript/flavours/glitch/features/explore/links.jsx @@ -67,6 +67,7 @@ class Links extends PureComponent { author={link.get('author_name')} sharedTimes={link.getIn(['history', 0, 'accounts']) * 1 + link.getIn(['history', 1, 'accounts']) * 1} thumbnail={link.get('image')} + thumbnailDescription={link.get('image_description')} blurhash={link.get('blurhash')} /> ))} diff --git a/app/javascript/flavours/glitch/features/status/components/card.jsx b/app/javascript/flavours/glitch/features/status/components/card.jsx index ff34b525a0..a64314efa3 100644 --- a/app/javascript/flavours/glitch/features/status/components/card.jsx +++ b/app/javascript/flavours/glitch/features/status/components/card.jsx @@ -178,7 +178,8 @@ export default class Card extends PureComponent { dummy={!useBlurhash} /> ); - let thumbnail = ; + const thumbnailDescription = card.get('image_description'); + const thumbnail = {thumbnailDescription}; let spoilerButton = (