diff --git a/app/models/commentaire.rb b/app/models/commentaire.rb index 1492c4bcb..7b3c651d9 100644 --- a/app/models/commentaire.rb +++ b/app/models/commentaire.rb @@ -17,6 +17,14 @@ class Commentaire < ActiveRecord::Base "#{email}, " + I18n.l(created_at.localtime, format: '%d %b %Y %H:%M') end + def file_url + if Features.remote_storage + RemoteDownloader.new(file.path).url + else + file.url + end + end + private def notify diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 691549ecb..f1443fe56 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -19,7 +19,7 @@ - if commentaire.file.present? .attachment-link - = link_to commentaire.file.url, class: "button", target: "_blank", title: "Télécharger" do + = link_to commentaire.file_url, class: "button", target: "_blank", title: "Télécharger" do .icon.attachment = commentaire.file_identifier - elsif commentaire.piece_justificative