diff options
author | rinsuki <428rinsuki+git@gmail.com> | 2019-02-04 12:46:05 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-02-04 04:46:05 +0100 |
commit | c78d64d9c399d58a49aa92fbb2c607bb681ef5a0 (patch) | |
tree | e5e26918abe7b10e777ebf6be4dea404b0e308e7 /app/models | |
parent | f86413fce29e70532fbbe5eab9ee8ff053f5552c (diff) |
Use video filesize limit with gifv (#9924)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/media_attachment.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 2e0f98cc6..a57ba0b2e 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -87,8 +87,8 @@ class MediaAttachment < ApplicationRecord convert_options: { all: '-quality 90 -strip' } validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES - validates_attachment_size :file, less_than: IMAGE_LIMIT, unless: :video? - validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :video? + validates_attachment_size :file, less_than: IMAGE_LIMIT, unless: :video_or_gifv? + validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :video_or_gifv? remotable_attachment :file, VIDEO_LIMIT include Attachmentable @@ -111,6 +111,10 @@ class MediaAttachment < ApplicationRecord file.blank? && remote_url.present? end + def video_or_gifv? + video? || gifv? + end + def to_param shortcode end |