Allow defining alt text for server thumbnail (#38796)

This commit is contained in:
diondiondion 2026-04-23 19:46:50 +02:00 committed by GitHub
parent be4ba1495c
commit a217b633b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 0 deletions

View File

@ -22,6 +22,7 @@ class Form::AdminSettings
custom_css custom_css
profile_directory profile_directory
thumbnail thumbnail
thumbnail_description
mascot mascot
trends trends
trendable_by_default trendable_by_default
@ -109,6 +110,7 @@ class Form::AdminSettings
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) } validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
validates :min_age, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@min_age) } validates :min_age, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@min_age) }
validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) } validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) }
validates :thumbnail_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@thumbnail_description) }
validates :status_page_url, url: true, allow_blank: true validates :status_page_url, url: true, allow_blank: true
validate :validate_site_uploads validate :validate_site_uploads
validates :landing_page, inclusion: { in: LANDING_PAGE }, if: -> { defined?(@landing_page) } validates :landing_page, inclusion: { in: LANDING_PAGE }, if: -> { defined?(@landing_page) }

View File

@ -26,6 +26,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
'@1x': full_asset_url(object.thumbnail.file.url(:'@1x')), '@1x': full_asset_url(object.thumbnail.file.url(:'@1x')),
'@2x': full_asset_url(object.thumbnail.file.url(:'@2x')), '@2x': full_asset_url(object.thumbnail.file.url(:'@2x')),
}, },
description: Setting.thumbnail_description,
} }
else else
{ {

View File

@ -33,6 +33,11 @@
= f.input :thumbnail, = f.input :thumbnail,
as: :file, as: :file,
wrapper: :with_block_label wrapper: :with_block_label
- if @admin_settings.thumbnail.persisted?
= f.input :thumbnail_description,
as: :text,
input_html: { rows: 2, maxlength: Form::AdminSettings::DESCRIPTION_LIMIT },
wrapper: :with_block_label
.fields-row__column.fields-row__column-6.fields-group .fields-row__column.fields-row__column-6.fields-group
- if @admin_settings.thumbnail.persisted? - if @admin_settings.thumbnail.persisted?
= image_tag @admin_settings.thumbnail.file.url(:'@1x'), class: 'fields-group__thumbnail' = image_tag @admin_settings.thumbnail.file.url(:'@1x'), class: 'fields-group__thumbnail'

View File

@ -109,6 +109,7 @@ en:
status_page_url: URL of a page where people can see the status of this server during an outage status_page_url: URL of a page where people can see the status of this server during an outage
theme: Theme that logged out visitors and new users see. theme: Theme that logged out visitors and new users see.
thumbnail: A roughly 2:1 image displayed alongside your server information. thumbnail: A roughly 2:1 image displayed alongside your server information.
thumbnail_description: A description of the image to help people with visual impairments understand its content.
trendable_by_default: Skip manual review of trending content. Individual items can still be removed from trends after the fact. trendable_by_default: Skip manual review of trending content. Individual items can still be removed from trends after the fact.
trends: Trends show which posts, hashtags and news stories are gaining traction on your server. trends: Trends show which posts, hashtags and news stories are gaining traction on your server.
wrapstodon: Offer local users to generate a playful summary of their Mastodon use during the year. This feature is available between the 10th and 31st of December of each year, and is offered to users who made at least one Public or Quiet Public post and used at least one hashtag within the year. wrapstodon: Offer local users to generate a playful summary of their Mastodon use during the year. This feature is available between the 10th and 31st of December of each year, and is offered to users who made at least one Public or Quiet Public post and used at least one hashtag within the year.
@ -317,6 +318,7 @@ en:
status_page_url: Status page URL status_page_url: Status page URL
theme: Default theme theme: Default theme
thumbnail: Server thumbnail thumbnail: Server thumbnail
thumbnail_description: Thumbnail alt text
trendable_by_default: Allow trends without prior review trendable_by_default: Allow trends without prior review
trends: Enable trends trends: Enable trends
wrapstodon: Enable Wrapstodon wrapstodon: Enable Wrapstodon

View File

@ -20,6 +20,7 @@ defaults: &defaults
preview_sensitive_media: false preview_sensitive_media: false
noindex: false noindex: false
theme: 'default' theme: 'default'
thumbnail_description: ''
trends: true trends: true
trendable_by_default: false trendable_by_default: false
disallowed_hashtags: # space separated string or list of hashtags without the hash disallowed_hashtags: # space separated string or list of hashtags without the hash