Skip to content
Extraits de code Groupes Projets
Valider c78d64d9 rédigé par rinsuki's avatar rinsuki Validation de Eugen Rochko
Parcourir les fichiers

Use video filesize limit with gifv (#9924)

parent f86413fc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -87,8 +87,8 @@ class MediaAttachment < ApplicationRecord ...@@ -87,8 +87,8 @@ class MediaAttachment < ApplicationRecord
convert_options: { all: '-quality 90 -strip' } convert_options: { all: '-quality 90 -strip' }
validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES 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: IMAGE_LIMIT, unless: :video_or_gifv?
validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :video? validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :video_or_gifv?
remotable_attachment :file, VIDEO_LIMIT remotable_attachment :file, VIDEO_LIMIT
include Attachmentable include Attachmentable
...@@ -111,6 +111,10 @@ class MediaAttachment < ApplicationRecord ...@@ -111,6 +111,10 @@ class MediaAttachment < ApplicationRecord
file.blank? && remote_url.present? file.blank? && remote_url.present?
end end
def video_or_gifv?
video? || gifv?
end
def to_param def to_param
shortcode shortcode
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter