From 150ff5e7ca3c83595070f0cb5384e3e175433617 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 7 Nov 2017 17:15:05 +0100 Subject: [PATCH] New UI : Use RemoteDownloader class to hide ovh url --- app/models/commentaire.rb | 8 ++++++++ app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) 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