When accessing uncached media attachment, redownload it (#4955)
* When accessing uncached media attachment, redownload it * Prevent re-download of rejected media
This commit is contained in:
parent
6c81f9d6e5
commit
54edb4b853
5 changed files with 60 additions and 5 deletions
|
@ -56,15 +56,21 @@ class MediaAttachment < ApplicationRecord
|
|||
|
||||
validates :account, presence: true
|
||||
|
||||
scope :attached, -> { where.not(status_id: nil) }
|
||||
scope :attached, -> { where.not(status_id: nil) }
|
||||
scope :unattached, -> { where(status_id: nil) }
|
||||
scope :local, -> { where(remote_url: '') }
|
||||
scope :local, -> { where(remote_url: '') }
|
||||
scope :remote, -> { where.not(remote_url: '') }
|
||||
|
||||
default_scope { order(id: :asc) }
|
||||
|
||||
def local?
|
||||
remote_url.blank?
|
||||
end
|
||||
|
||||
def needs_redownload?
|
||||
file.blank? && remote_url.present?
|
||||
end
|
||||
|
||||
def to_param
|
||||
shortcode
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue