Remove commentaire file uploader

This commit is contained in:
Paul Chavard 2019-08-14 13:00:52 +01:00
parent 522d45839b
commit e9ba7700d4
3 changed files with 2 additions and 95 deletions

View file

@ -4,7 +4,6 @@ class Commentaire < ApplicationRecord
belongs_to :user
belongs_to :instructeur
mount_uploader :file, CommentaireFileUploader
validate :messagerie_available?, on: :create
has_one_attached :piece_jointe
@ -48,15 +47,8 @@ class Commentaire < ApplicationRecord
end
def file_url
if piece_jointe.attached?
if piece_jointe.virus_scanner.safe?
Rails.application.routes.url_helpers.url_for(piece_jointe)
end
elsif Rails.application.secrets.fog[:enabled]
RemoteDownloader.new(file.path).url
elsif file&.url
# FIXME: this is horrible but used only in dev and will be removed after migration
File.join(LOCAL_DOWNLOAD_URL, file.url)
if piece_jointe.attached? && piece_jointe.virus_scanner.safe?
Rails.application.routes.url_helpers.url_for(piece_jointe)
end
end