Compare commits
2 Commits
dion/conve
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15a7507a09 | ||
|
|
cdf721a273 |
@@ -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? }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user