Merge branch 'main' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2021-10-06 16:46:32 +02:00
5 changed files with 63 additions and 17 deletions

View File

@ -167,12 +167,11 @@ class MediaAttachment < ApplicationRecord
processors: ->(f) { file_processors f },
convert_options: GLOBAL_CONVERT_OPTIONS
before_file_post_process :set_type_and_extension
before_file_post_process :check_video_dimensions
before_file_validate :set_type_and_extension
before_file_validate :check_video_dimensions
validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES + AUDIO_MIME_TYPES
validates_attachment_size :file, less_than: IMAGE_LIMIT, unless: :larger_media_format?
validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :larger_media_format?
validates_attachment_size :file, less_than: ->(m) { m.larger_media_format? ? VIDEO_LIMIT : IMAGE_LIMIT }
remotable_attachment :file, VIDEO_LIMIT, suppress_errors: false, download_on_assign: false, attribute_name: :remote_url
has_attached_file :thumbnail,