From 9c951f3a0f379b0f459988106cf3f839acdadbe2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 21 Jul 2026 22:28:18 +0200 Subject: More PDF headline eligibility --- app/models/asset.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models') diff --git a/app/models/asset.rb b/app/models/asset.rb index 4a295d8..8aa5415 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -1,5 +1,6 @@ class Asset < ApplicationRecord IMAGE_CONTENT_TYPES = ["image/gif", "image/jpeg", "image/png", "image/webp"] + PDF_CONTENT_TYPE = "application/pdf" include FileAttachment @@ -9,6 +10,7 @@ class Asset < ApplicationRecord scope :images, -> { where(:upload_content_type => IMAGE_CONTENT_TYPES) } scope :documents, -> { where(:upload_content_type => ["application/pdf", "text/plain", "text/rtf"]) } scope :audio, -> { where(:upload_content_type => ["audio/mpeg", "audio/x-m4a", "audio/wav", "audio/x-wav"]) } + scope :headline_eligible, -> { where(:upload_content_type => IMAGE_CONTENT_TYPES + [PDF_CONTENT_TYPE]) } validates :license_key, inclusion: { in: -> { AssetLicense.keys } }, allow_blank: true @@ -16,6 +18,10 @@ class Asset < ApplicationRecord IMAGE_CONTENT_TYPES.include?(upload_content_type) end + def pdf? + upload_content_type == PDF_CONTENT_TYPE + end + def has_credit? creator.present? || source_url.present? || license_key.present? end -- cgit v1.3