|
|
@ -54,9 +54,6 @@ class Attachment < ApplicationRecord |
|
|
|
|
|
|
|
|
|
|
|
after_commit :extract_fulltext, on: :create |
|
|
|
after_commit :extract_fulltext, on: :create |
|
|
|
|
|
|
|
|
|
|
|
after_create :schedule_cleanup_uncontainered_job, |
|
|
|
|
|
|
|
unless: :containered? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
## |
|
|
|
# Returns an URL if the attachment is stored in an external (fog) attachment storage |
|
|
|
# Returns an URL if the attachment is stored in an external (fog) attachment storage |
|
|
|
# or nil otherwise. |
|
|
|
# or nil otherwise. |
|
|
@ -293,10 +290,6 @@ class Attachment < ApplicationRecord |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def schedule_cleanup_uncontainered_job |
|
|
|
|
|
|
|
Attachments::CleanupUncontaineredJob.perform_later |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def filesize_below_allowed_maximum |
|
|
|
def filesize_below_allowed_maximum |
|
|
|
if filesize > Setting.attachment_max_size.to_i.kilobytes |
|
|
|
if filesize > Setting.attachment_max_size.to_i.kilobytes |
|
|
|
errors.add(:file, :file_too_large, count: Setting.attachment_max_size.to_i.kilobytes) |
|
|
|
errors.add(:file, :file_too_large, count: Setting.attachment_max_size.to_i.kilobytes) |
|
|
|