Prevent posting toots with media attachments from someone else (#9921)

This commit is contained in:
ThibG 2019-01-26 23:59:39 +01:00 committed by Eugen Rochko
parent 9519d55332
commit e2a5be6e9a
2 changed files with 15 additions and 2 deletions

View file

@ -93,7 +93,7 @@ class PostStatusService < BaseService
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4
@media = MediaAttachment.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:video?)
end