From c5704fa22fcc65b15f04077c58d51300b658368b Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 25 Jun 2019 16:37:24 +0200 Subject: [PATCH] Remove unused code from Commentaire --- app/models/commentaire.rb | 1 - app/views/shared/dossiers/messages/_message.html.haml | 7 +------ spec/models/commentaire_spec.rb | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/models/commentaire.rb b/app/models/commentaire.rb index 68b571164..866593071 100644 --- a/app/models/commentaire.rb +++ b/app/models/commentaire.rb @@ -1,6 +1,5 @@ class Commentaire < ApplicationRecord belongs_to :dossier, inverse_of: :commentaires, touch: true - belongs_to :piece_justificative belongs_to :user belongs_to :gestionnaire diff --git a/app/views/shared/dossiers/messages/_message.html.haml b/app/views/shared/dossiers/messages/_message.html.haml index 518fbc191..74f314ad8 100644 --- a/app/views/shared/dossiers/messages/_message.html.haml +++ b/app/views/shared/dossiers/messages/_message.html.haml @@ -10,12 +10,7 @@ = commentaire_date(commentaire) .rich-text= sanitize(simple_format(commentaire.body)) - - if commentaire.piece_justificative - .attachment-link - = link_to commentaire.piece_justificative.content_url, class: "button", target: "_blank", rel: "noopener", title: "Télécharger" do - %span.icon.attachment - = commentaire.piece_justificative.original_filename - - elsif commentaire.file.present? + - if commentaire.file.present? .attachment-link = link_to commentaire.file_url, class: "button", target: "_blank", rel: "noopener", title: "Télécharger" do %span.icon.attachment diff --git a/spec/models/commentaire_spec.rb b/spec/models/commentaire_spec.rb index 0c58a56bf..9822f15db 100644 --- a/spec/models/commentaire_spec.rb +++ b/spec/models/commentaire_spec.rb @@ -7,8 +7,6 @@ describe Commentaire do it { is_expected.to have_db_column(:updated_at) } it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:piece_justificative) } - describe "#notify" do let(:procedure) { create(:procedure) } let(:gestionnaire) { create(:gestionnaire) }