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)
|
def notify_transfer(transfer)
|
||||||
I18n.with_locale(transfer.user_locale) do
|
I18n.with_locale(transfer.user_locale) do
|
||||||
@subject = default_i18n_subject(count: transfer.dossiers.size)
|
@subject = default_i18n_subject()
|
||||||
@transfer = transfer
|
@transfer = transfer
|
||||||
|
|
||||||
mail(to: transfer.email, subject: @subject)
|
mail(to: transfer.email, subject: @subject)
|
||||||
|
|
|
@ -58,6 +58,18 @@ class DossierTransfer < ApplicationRecord
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
def send_notification
|
def send_notification
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
- content_for(:title, "#{@subject}")
|
|
||||||
|
|
||||||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||||
|
|
||||||
%p
|
%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')
|
= link_to t('.transfer_link'), dossiers_url(statut: 'dossiers-transferes')
|
||||||
|
|
||||||
= render partial: "layouts/mailers/signature"
|
= render partial: "layouts/mailers/signature"
|
||||||
|
|
|
@ -487,8 +487,9 @@ en:
|
||||||
deleted: Deleted at %{date}
|
deleted: Deleted at %{date}
|
||||||
deleted_badge: Deleted
|
deleted_badge: Deleted
|
||||||
transfers:
|
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 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: "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}"
|
receiver_demande_en_cours_from_support: "Transfer request from technical support on file Nº %{id} of %{email}"
|
||||||
revoke: Revoke this request
|
revoke: Revoke this request
|
||||||
|
|
|
@ -500,6 +500,7 @@ fr:
|
||||||
actions: "Actions"
|
actions: "Actions"
|
||||||
other_actions: "Autres actions"
|
other_actions: "Autres actions"
|
||||||
transfers:
|
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: "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}"
|
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}"
|
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:
|
fr:
|
||||||
dossier_mailer:
|
dossier_mailer:
|
||||||
notify_transfer:
|
notify_transfer:
|
||||||
subject:
|
subject: Vous avez une demande de transfert en attente.
|
||||||
one: Une demande de transfert de dossier vous est adressée
|
transfer_text: "Accéder à la demande de transfert du dossier en cliquant sur le lien suivant :"
|
||||||
other: Une demande de transfert de dossiers vous est adressée
|
|
||||||
transfer_link: demande de transfert
|
transfer_link: demande de transfert
|
||||||
body:
|
transfert_multiple: "%{sender} vous adresse une demande de transfert pour %{count} dossiers."
|
||||||
one: |
|
transfert_simple: "%{sender} vous adresse une demande de transfert pour le dossier n° %{dossier_id} sur la démarche"
|
||||||
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 :
|
|
||||||
|
|
|
@ -265,4 +265,34 @@ RSpec.describe DossierMailer, type: :mailer do
|
||||||
it { expect(subject.body).to include("réinitialisé") }
|
it { expect(subject.body).to include("réinitialisé") }
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue