Compare commits

...

2 Commits

Author SHA1 Message Date
diondiondion
15a7507a09 Use radio buttons for emoji style preference (#39126) 2026-05-21 16:55:28 +00:00
Claire
cdf721a273 Fix remote statuses with large media descriptions being rejected (#39135) 2026-05-21 15:46:10 +00:00
3 changed files with 17 additions and 18 deletions

View File

@@ -205,7 +205,7 @@ class MediaAttachment < ApplicationRecord
remotable_attachment :thumbnail, IMAGE_LIMIT, suppress_errors: true, download_on_assign: false
validates :account, presence: true
validates :description, length: { maximum: MAX_DESCRIPTION_LENGTH }
validates :description, length: { maximum: MAX_DESCRIPTION_LENGTH }, if: :local?
validates :file, presence: true, if: :local?
validates :thumbnail, absence: true, if: -> { local? && !audio_or_video? }

View File

@@ -51,17 +51,16 @@
label_method: ->(contrast) { I18n.t("contrast.#{contrast}", default: contrast) },
wrapper: :with_label,
required: false
.fields-group
= f.simple_fields_for :settings, current_user.settings do |ff|
= ff.input :'web.emoji_style',
collection: user_settings_collection('web.emoji_style'),
include_blank: false,
hint: I18n.t('simple_form.hints.defaults.setting_emoji_style'),
label: I18n.t('simple_form.labels.defaults.setting_emoji_style'),
label_method: ->(emoji_style) { I18n.t("emoji_styles.#{emoji_style}", default: emoji_style) },
wrapper: :with_label,
required: false
.input.horizontal-options
= ff.input :'web.emoji_style',
as: :radio_buttons,
collection: user_settings_collection('web.emoji_style'),
include_blank: false,
hint: I18n.t('simple_form.hints.defaults.setting_emoji_style'),
label: I18n.t('simple_form.labels.defaults.setting_emoji_style'),
label_method: ->(emoji_style) { I18n.t("emoji_styles.#{emoji_style}", default: emoji_style) },
wrapper: :with_label,
required: false
- unless I18n.locale == :en
.flash-message.translation-prompt

View File

@@ -608,19 +608,19 @@ RSpec.describe ActivityPub::Activity::Create do
type: 'Document',
mediaType: 'image/png',
url: 'http://example.com/attachment.png',
name: '*' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
name: '*' * (MediaAttachment::MAX_DESCRIPTION_HARD_LENGTH_LIMIT + 5),
},
]
)
end
it 'creates status' do
it 'creates status with truncated description' do
expect { subject.perform }.to change(sender.statuses, :count).by(1)
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_LENGTH)
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_HARD_LENGTH_LIMIT)
end
end
@@ -632,19 +632,19 @@ RSpec.describe ActivityPub::Activity::Create do
type: 'Document',
mediaType: 'image/png',
url: 'http://example.com/attachment.png',
summary: '*' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
summary: '*' * (MediaAttachment::MAX_DESCRIPTION_HARD_LENGTH_LIMIT + 5),
},
]
)
end
it 'creates status' do
it 'creates status with truncated description' do
expect { subject.perform }.to change(sender.statuses, :count).by(1)
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_LENGTH)
expect(status.media_attachments.map(&:description)).to include('*' * MediaAttachment::MAX_DESCRIPTION_HARD_LENGTH_LIMIT)
end
end