0
0
Fork 0

Fix media attachments without file being uploadable (#12562)

Fix #12554
This commit is contained in:
Eugen Rochko 2020-01-23 21:40:03 +01:00 committed by GitHub
parent 43daeccccb
commit 81cc86bb1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 21 deletions

View file

@ -142,6 +142,7 @@ class MediaAttachment < ApplicationRecord
validates :account, presence: true
validates :description, length: { maximum: MAX_DESCRIPTION_LENGTH }, if: :local?
validates :file, presence: true, if: :local?
scope :attached, -> { where.not(status_id: nil).or(where.not(scheduled_status_id: nil)) }
scope :unattached, -> { where(status_id: nil, scheduled_status_id: nil) }