introduce virus scans

This commit is contained in:
clemkeirua 2019-03-28 16:31:34 +01:00
parent f8a2598647
commit b3956bc072
3 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
class Dossier < ApplicationRecord
include DossierFilteringConcern
include VirusScanConcern
enum state: {
brouillon: 'brouillon',
@ -98,6 +99,9 @@ class Dossier < ApplicationRecord
after_save :send_web_hook
after_create :send_draft_notification_email
after_commit :create_dossier_virus_scan
after_initialize { add_virus_scan_on(self.justificatif_motivation) }
validates :user, presence: true
def update_search_terms
@ -413,4 +417,8 @@ class Dossier < ApplicationRecord
)
end
end
def create_dossier_virus_scan
create_virus_scan(self.justificatif_motivation)
end
end

View file

@ -1,6 +1,6 @@
- if dossier.present?
- justificatif = dossier.justificatif_motivation
- if dossier.justificatif_motivation.attached?
- if dossier.justificatif_motivation.attached? and dossier.virus_scan.safe?
.action
= link_to (justificatif), target: '_blank', class: 'button primary' do
%span.icon.download

View file

@ -4,11 +4,8 @@
%th.libelle Déposé le :
%td= l(dossier.en_construction_at, format: '%d %B %Y')
- if dossier.justificatif_motivation.attached?
- justificatif = dossier.justificatif_motivation
%tr
%th.libelle Justificatif :
%td
.action
= link_to url_for(justificatif), target: '_blank', class: 'button primary' do
%span.icon.download
Télécharger le justificatif
= render partial: 'shared/piece_jointe/pj_link', locals: { object: dossier, pj: dossier.justificatif_motivation }