reduce unneed query when post without attachements. (#1907)

* reduce unneed query when post without attachements.

This commit reduce following query:

```
 MediaAttachment Load (0.9ms)  SELECT "media_attachments".* FROM "media_attachments" WHERE "media_attachments"."status
_id" IS NULL AND 1=0 ORDER BY id asc
```

* fixed for more simple changes.
lolsob-rspec
Keiji, Yoshimi 2017-04-17 11:23:13 +09:00 committed by Eugen
parent aed7a3f11e
commit 4863184f88
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class PostStatusService < BaseService
private
def validate_media!(media_ids)
return if media_ids.nil? || !media_ids.is_a?(Enumerable)
return if media_ids.blank? || !media_ids.is_a?(Enumerable)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if media_ids.size > 4