1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add lang attribute to trending links (#26111)

This commit is contained in:
Christian Schmidt 2023-07-24 13:48:23 +02:00 committed by GitHub
parent 80809ef33e
commit 76fce34ebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -13,6 +13,7 @@ export default class Story extends PureComponent {
static propTypes = { static propTypes = {
url: PropTypes.string, url: PropTypes.string,
title: PropTypes.string, title: PropTypes.string,
lang: PropTypes.string,
publisher: PropTypes.string, publisher: PropTypes.string,
sharedTimes: PropTypes.number, sharedTimes: PropTypes.number,
thumbnail: PropTypes.string, thumbnail: PropTypes.string,
@ -26,15 +27,15 @@ export default class Story extends PureComponent {
handleImageLoad = () => this.setState({ thumbnailLoaded: true }); handleImageLoad = () => this.setState({ thumbnailLoaded: true });
render () { render () {
const { url, title, publisher, sharedTimes, thumbnail, blurhash } = this.props; const { url, title, lang, publisher, sharedTimes, thumbnail, blurhash } = this.props;
const { thumbnailLoaded } = this.state; const { thumbnailLoaded } = this.state;
return ( return (
<a className='story' href={url} target='blank' rel='noopener'> <a className='story' href={url} target='blank' rel='noopener'>
<div className='story__details'> <div className='story__details'>
<div className='story__details__publisher'>{publisher ? publisher : <Skeleton width={50} />}</div> <div className='story__details__publisher' lang={lang}>{publisher ? publisher : <Skeleton width={50} />}</div>
<div className='story__details__title'>{title ? title : <Skeleton />}</div> <div className='story__details__title' lang={lang}>{title ? title : <Skeleton />}</div>
<div className='story__details__shared'>{typeof sharedTimes === 'number' ? <ShortNumber value={sharedTimes} renderer={accountsCountRenderer} /> : <Skeleton width={100} />}</div> <div className='story__details__shared'>{typeof sharedTimes === 'number' ? <ShortNumber value={sharedTimes} renderer={accountsCountRenderer} /> : <Skeleton width={100} />}</div>
</div> </div>

View file

@ -58,6 +58,7 @@ class Links extends PureComponent {
{isLoading ? (<LoadingIndicator />) : links.map(link => ( {isLoading ? (<LoadingIndicator />) : links.map(link => (
<Story <Story
key={link.get('id')} key={link.get('id')}
lang={link.get('language')}
url={link.get('url')} url={link.get('url')}
title={link.get('title')} title={link.get('title')}
publisher={link.get('provider_name')} publisher={link.get('provider_name')}