add more info in notify transfer email
This commit is contained in:
parent
e52bd9d6bf
commit
ff284a1c96
8 changed files with 68 additions and 13 deletions
|
@ -164,7 +164,7 @@ class DossierMailer < ApplicationMailer
|
|||
|
||||
def notify_transfer(transfer)
|
||||
I18n.with_locale(transfer.user_locale) do
|
||||
@subject = default_i18n_subject(count: transfer.dossiers.size)
|
||||
@subject = default_i18n_subject()
|
||||
@transfer = transfer
|
||||
|
||||
mail(to: transfer.email, subject: @subject)
|
||||
|
|
|
@ -58,6 +58,18 @@ class DossierTransfer < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def sender
|
||||
if from_support?
|
||||
I18n.t("views.users.dossiers.transfers.sender_from_support")
|
||||
else
|
||||
sender_email
|
||||
end
|
||||
end
|
||||
|
||||
def sender_email
|
||||
dossiers.last.user.email
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_notification
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
- content_for(:title, "#{@subject}")
|
||||
|
||||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t('.body', count: @transfer.dossiers.size)
|
||||
- if @transfer.dossiers.size > 1
|
||||
= t('.transfert_multiple', sender: @transfer.sender, count: @transfer.dossiers.size)
|
||||
- else
|
||||
- dossier = @transfer.dossiers.last
|
||||
= t('.transfert_simple', sender: @transfer.sender, dossier_id: dossier.id)
|
||||
%span{ :style => "font-weight: bold;" }
|
||||
= dossier.procedure.libelle
|
||||
|
||||
%p
|
||||
= t('.transfer_text')
|
||||
= link_to t('.transfer_link'), dossiers_url(statut: 'dossiers-transferes')
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -487,8 +487,9 @@ en:
|
|||
deleted: Deleted at %{date}
|
||||
deleted_badge: Deleted
|
||||
transfers:
|
||||
sender_from_support: Technical support
|
||||
sender_demande_en_cours: "A transfer request is pending on file Nº %{id} to %{email}"
|
||||
sender_demande_en_cours: "A transfer request from technical support is pending on file Nº %{id} to %{email}"
|
||||
sender_demande_en_cours_from_support: "A transfer request from technical support is pending on file Nº %{id} to %{email}"
|
||||
receiver_demande_en_cours: "Transfer request on file Nº %{id} sent by %{email}"
|
||||
receiver_demande_en_cours_from_support: "Transfer request from technical support on file Nº %{id} of %{email}"
|
||||
revoke: Revoke this request
|
||||
|
|
|
@ -500,6 +500,7 @@ fr:
|
|||
actions: "Actions"
|
||||
other_actions: "Autres actions"
|
||||
transfers:
|
||||
sender_from_support: Le support technique
|
||||
sender_demande_en_cours: "Une demande de transfert est en cours sur le dossier Nº %{id} pour %{email}"
|
||||
sender_demande_en_cours_from_support: "Une demande de transfert par le support technique est en cours sur le dossier Nº %{id} pour %{email}"
|
||||
receiver_demande_en_cours: "Demande de transfert pour le dossier Nº %{id} envoyé par %{email}"
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
en:
|
||||
dossier_mailer:
|
||||
notify_transfer:
|
||||
subject: You have a pending transfer request.
|
||||
transfer_text: "Access the file transfer request by clicking on the following link:"
|
||||
transfer_link: transfer request
|
||||
transfert_multiple: "%{sender} sends you a transfer request for %{count} files."
|
||||
transfert_simple: "%{sender} sends you a transfer request for file no. %{dossier_id} on the procedure"
|
|
@ -1,12 +1,8 @@
|
|||
fr:
|
||||
dossier_mailer:
|
||||
notify_transfer:
|
||||
subject:
|
||||
one: Une demande de transfert de dossier vous est adressée
|
||||
other: Une demande de transfert de dossiers vous est adressée
|
||||
subject: Vous avez une demande de transfert en attente.
|
||||
transfer_text: "Accéder à la demande de transfert du dossier en cliquant sur le lien suivant :"
|
||||
transfer_link: demande de transfert
|
||||
body:
|
||||
one: |
|
||||
Accéder à la demande de transfert du dossier en cliquant sur le lien suivant :
|
||||
other: |
|
||||
Accéder à la demande de transfert de %{count} dossiers en cliquant sur le lien suivant :
|
||||
transfert_multiple: "%{sender} vous adresse une demande de transfert pour %{count} dossiers."
|
||||
transfert_simple: "%{sender} vous adresse une demande de transfert pour le dossier n° %{dossier_id} sur la démarche"
|
||||
|
|
|
@ -265,4 +265,34 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
it { expect(subject.body).to include("réinitialisé") }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'notify_transfer' do
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier_transfer) { create(:dossier_transfer) }
|
||||
let!(:dossier) { create(:dossier, user: user, transfer: dossier_transfer, procedure: procedure) }
|
||||
|
||||
subject { described_class.notify_transfer(dossier_transfer) }
|
||||
|
||||
context 'when it is a transfer of one dossier' do
|
||||
it { expect(subject.subject).to include("Vous avez une demande de transfert en attente.") }
|
||||
it { expect(subject.body).to include("#{user.email} vous adresse une demande de transfert pour le dossier n° #{dossier.id} sur la démarche") }
|
||||
it { expect(subject.body).to include(procedure.libelle.to_s) }
|
||||
end
|
||||
|
||||
context 'when it is a transfer of multiple dossiers' do
|
||||
let!(:dossier2) { create(:dossier, user: user, transfer: dossier_transfer, procedure: procedure) }
|
||||
it { expect(subject.subject).to include("Vous avez une demande de transfert en attente.") }
|
||||
it { expect(subject.body).to include("#{user.email} vous adresse une demande de transfert pour 2 dossiers.") }
|
||||
end
|
||||
|
||||
context 'when it is a transfer of one dossier from super admin' do
|
||||
before do
|
||||
dossier_transfer.update!(from_support: true)
|
||||
end
|
||||
|
||||
it { expect(subject.subject).to include("Vous avez une demande de transfert en attente.") }
|
||||
it { expect(subject.body).to include("Le support technique vous adresse une demande de transfert") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue