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
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) }