1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-11-25 15:46:35 +09:00

Correctly make polls and media mutually exclusive (#10141)

This commit is contained in:
ThibG 2019-03-04 00:40:21 +01:00 committed by Eugen Rochko
parent e13d3792f3
commit f821eca3b3

View File

@ -95,7 +95,7 @@ class PostStatusService < BaseService
def validate_media! def validate_media!
return if @options[:media_ids].blank? || !@options[:media_ids].is_a?(Enumerable) return if @options[:media_ids].blank? || !@options[:media_ids].is_a?(Enumerable)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll_id].present? raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
@media = @account.media_attachments.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))