0
0
Fork 0

media_ids is an array of strings (#31709)

This commit is contained in:
Christian Schmidt 2024-09-02 22:18:09 +02:00 committed by GitHub
parent c1795ee963
commit a5bbe83dfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View file

@ -73,7 +73,7 @@ class UpdateStatusService < BaseService
media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(Status::MEDIA_ATTACHMENTS_LIMIT).map(&:to_i)).to_a
not_found_ids = @options[:media_ids] - media_attachments.map(&:id)
not_found_ids = @options[:media_ids].map(&:to_i) - media_attachments.map(&:id)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_found', ids: not_found_ids.join(', ')) if not_found_ids.any?
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if media_attachments.size > 1 && media_attachments.find(&:audio_or_video?)