From 8000a8f2309d428c2ce72fe5ffba940754d55339 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Fri, 24 Feb 2023 20:04:38 +0100 Subject: [PATCH] Add `lang` attribute to preview card (#23869) --- app/javascript/mastodon/features/status/components/card.jsx | 3 ++- app/serializers/rest/preview_card_serializer.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/status/components/card.jsx b/app/javascript/mastodon/features/status/components/card.jsx index 34fac1010..b588c83e4 100644 --- a/app/javascript/mastodon/features/status/components/card.jsx +++ b/app/javascript/mastodon/features/status/components/card.jsx @@ -196,11 +196,12 @@ export default class Card extends React.PureComponent { const interactive = card.get('type') !== 'link'; const className = classnames('status-card', { horizontal, compact, interactive }); const title = interactive ? {card.get('title')} : {card.get('title')}; + const language = card.get('language') || ''; const ratio = card.get('width') / card.get('height'); const height = (compact && !embedded) ? (width / (16 / 9)) : (width / ratio); const description = ( -
+
{title} {!(horizontal || compact) &&

{trim(card.get('description') || '', maxDescription)}

} {provider} diff --git a/app/serializers/rest/preview_card_serializer.rb b/app/serializers/rest/preview_card_serializer.rb index 66ff47d22..8413b23d8 100644 --- a/app/serializers/rest/preview_card_serializer.rb +++ b/app/serializers/rest/preview_card_serializer.rb @@ -3,7 +3,7 @@ class REST::PreviewCardSerializer < ActiveModel::Serializer include RoutingHelper - attributes :url, :title, :description, :type, + attributes :url, :title, :description, :language, :type, :author_name, :author_url, :provider_name, :provider_url, :html, :width, :height, :image, :embed_url, :blurhash