hide decision from email for tiers if procedure has accuse de lecture

This commit is contained in:
Lisa Durand 2024-04-03 11:07:40 +02:00
parent 18602e046a
commit 71268c7f3b
9 changed files with 25 additions and 10 deletions

View file

@ -79,7 +79,7 @@ module DossierHelper
end
def status_badge_user(dossier, alignment_class = '')
if dossier.hide_info_with_accuse_lecture
if dossier.hide_info_with_accuse_lecture?
tag.span 'traité', role: 'status', class: class_names(
'fr-badge fr-badge--sm fr-badge--no-icon' => true,
alignment_class => true

View file

@ -124,8 +124,8 @@ module DossierStateConcern
NotificationMailer.send_accuse_lecture_notification(self).deliver_later
else
NotificationMailer.send_accepte_notification(self).deliver_later
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
send_dossier_decision_to_experts(self)
@ -160,8 +160,8 @@ module DossierStateConcern
NotificationMailer.send_accuse_lecture_notification(self).deliver_later
else
NotificationMailer.send_accepte_notification(self).deliver_later
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
send_dossier_decision_to_experts(self)
remove_titres_identite!
@ -196,8 +196,8 @@ module DossierStateConcern
NotificationMailer.send_accuse_lecture_notification(self).deliver_later
else
NotificationMailer.send_refuse_notification(self).deliver_later
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
send_dossier_decision_to_experts(self)
@ -225,8 +225,8 @@ module DossierStateConcern
NotificationMailer.send_accuse_lecture_notification(self).deliver_later
else
NotificationMailer.send_refuse_notification(self).deliver_later
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
send_dossier_decision_to_experts(self)
remove_titres_identite!
@ -261,8 +261,8 @@ module DossierStateConcern
NotificationMailer.send_accuse_lecture_notification(self).deliver_later
else
NotificationMailer.send_sans_suite_notification(self).deliver_later
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
NotificationMailer.send_notification_for_tiers(self).deliver_later if self.for_tiers?
end
send_dossier_decision_to_experts(self)

View file

@ -1180,7 +1180,7 @@ class Dossier < ApplicationRecord
end
end
def hide_info_with_accuse_lecture
def hide_info_with_accuse_lecture?
procedure.accuse_lecture? && termine? && accuse_lecture_agreement_at.blank?
end

View file

@ -15,8 +15,10 @@
- if @repasser_en_instruction
= t("layouts.mailers.for_tiers.repasser_en_instruction")
- elsif @dossier.hide_info_with_accuse_lecture?
= t("layouts.mailers.for_tiers.accuse_lecture", processed_at: l(@dossier.updated_at.to_date))
- else
= t("layouts.mailers.for_tiers.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date) )
= t("layouts.mailers.for_tiers.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date))
%p
= t("layouts.mailers.for_tiers.second_part")

View file

@ -9,7 +9,7 @@
.fr-highlight
%p.fr-text--sm.fr-text-mention--grey Sauf mention contraire, les champs ont été saisis à la date du dépôt du dossier.
- if profile == 'usager' && dossier.hide_info_with_accuse_lecture
- if profile == 'usager' && dossier.hide_info_with_accuse_lecture?
= render Dossiers::AccuseLectureComponent.new(dossier: dossier)
- else

View file

@ -55,7 +55,7 @@
= t('views.users.dossiers.show.status_overview.use_mailbox_for_questions_html', mailbox_url: messagerie_dossier_url(dossier))
- elsif dossier.termine?
- if dossier.hide_info_with_accuse_lecture
- if dossier.hide_info_with_accuse_lecture?
= render Dossiers::AccuseLectureComponent.new(dossier: dossier)
- elsif dossier.accepte?

View file

@ -24,6 +24,7 @@ en:
accepte: has been accepted on %{processed_at}.
refuse: has been refused on %{processed_at}.
sans_suite: has been closed without continuation on %{processed_at}.
accuse_lecture: has been processed on %{processed_at}.
accuse_lecture:
good_morning: Hello,
first_part: We inform you that a decision on file no. %{dossier_id} of the procedure

View file

@ -25,6 +25,7 @@ fr:
accepte: a été accepté le %{processed_at}.
refuse: a été refusé le %{processed_at}.
sans_suite: a été classé sans suite le %{processed_at}.
accuse_lecture: a été traité le %{processed_at}.
accuse_lecture:
good_morning: Bonjour,
first_part: Nous vous informons qu'une décision sur le dossier nº %{dossier_id} de la démarche

View file

@ -29,6 +29,17 @@ RSpec.describe NotificationMailer, type: :mailer do
end
end
describe 'send_notification_for_tiers with accuse lecture procedure' do
let(:dossier_for_tiers) { create(:dossier, :accepte, :for_tiers_with_notification, procedure: create(:procedure, :accuse_lecture, :for_individual)) }
subject { described_class.send_notification_for_tiers(dossier_for_tiers) }
it { expect(subject.subject).to include("Votre dossier rempli par le mandataire #{dossier_for_tiers.mandataire_first_name} #{dossier_for_tiers.mandataire_last_name} a été mis à jour") }
it { expect(subject.to).to eq([dossier_for_tiers.individual.email]) }
it { expect(subject.body).to include("a été traité le") }
it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de\r\n<a href=\"mailto:#{dossier_for_tiers.user.email}\">#{dossier_for_tiers.user.email}</a>.") }
end
describe 'send_accuse_lecture_notification' do
let(:dossier) { create(:dossier, :accepte, procedure: create(:procedure, :accuse_lecture)) }
subject { described_class.send_accuse_lecture_notification(dossier) }