Add support for displaying link previews for Admin UI (#35958)

This commit is contained in:
Emelia Smith
2025-10-10 10:43:48 +02:00
committed by GitHub
parent c858fc77ef
commit 81350c7cfb
7 changed files with 154 additions and 0 deletions

View File

@@ -57,6 +57,20 @@ module StatusesHelper
components.compact_blank.join("\n\n")
end
# This logic should be kept in sync with https://github.com/mastodon/mastodon/blob/425311e1d95c8a64ddac6c724fca247b8b893a82/app/javascript/mastodon/features/status/components/card.jsx#L160
def preview_card_aspect_ratio_classname(preview_card)
interactive = preview_card.type == 'video'
large_image = (preview_card.image.present? && preview_card.width > preview_card.height) || interactive
if large_image && interactive
'status-card__image--video'
elsif large_image
'status-card__image--large'
else
'status-card__image--normal'
end
end
def visibility_icon(status)
VISIBLITY_ICONS[status.visibility.to_sym]
end