Merge pull request #10224 from colinux/mail-host
Tech (mailers): `from`, liens et application en respectent le preferred domain du destinataire
This commit is contained in:
commit
df59503ab7
68 changed files with 602 additions and 264 deletions
|
@ -1 +1,2 @@
|
|||
APP_HOST="test.host" # must match host defined in spec/rails_helper.rb
|
||||
APP_HOST_LEGACY="test-legacy.host"
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
BIN
app/assets/images/mailer/republique-francaise-logo.png
Normal file
BIN
app/assets/images/mailer/republique-francaise-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -19,7 +19,7 @@ module MailerHelper
|
|||
end
|
||||
|
||||
def blue
|
||||
'#0069CC'
|
||||
'#000091'
|
||||
end
|
||||
|
||||
def white
|
||||
|
|
|
@ -7,7 +7,7 @@ class APITokenMailer < ApplicationMailer
|
|||
def expiration(api_token)
|
||||
@api_token = api_token
|
||||
user = api_token.administrateur.user
|
||||
subject = "Votre jeton d'accès à la plateforme #{APPLICATION_NAME} expire le #{l(@api_token.expires_at, format: :long)}"
|
||||
subject = "Votre jeton d'accès à la plateforme #{Current.application_name} expire le #{l(@api_token.expires_at, format: :long)}"
|
||||
|
||||
mail(to: user.email, subject:)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class ApplicationMailer < ActionMailer::Base
|
||||
include MailerDefaultsConfigurableConcern
|
||||
include MailerDolistConcern
|
||||
include MailerMonitoringConcern
|
||||
include BalancedDeliveryConcern
|
||||
|
|
80
app/mailers/concerns/mailer_defaults_configurable_concern.rb
Normal file
80
app/mailers/concerns/mailer_defaults_configurable_concern.rb
Normal file
|
@ -0,0 +1,80 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module MailerDefaultsConfigurableConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
# Save original defaults before they're modified
|
||||
def save_original_defaults
|
||||
@original_default_from ||= self.default[:from]
|
||||
@original_default_host ||= Rails.application.routes.default_url_options[:host]
|
||||
@original_asset_host ||= asset_host
|
||||
end
|
||||
|
||||
# Resets mailer settings to their original values
|
||||
def reset_original_defaults
|
||||
default from: original_default_from, reply_to: original_default_from
|
||||
default_url_options[:host] = original_default_host
|
||||
Rails.application.routes.default_url_options[:host] = original_default_host
|
||||
self.asset_host = original_asset_host
|
||||
end
|
||||
|
||||
def original_default_from = @original_default_from
|
||||
def original_default_host = @original_default_host
|
||||
def original_asset_host = @original_asset_host
|
||||
end
|
||||
|
||||
included do
|
||||
before_action -> { self.class.save_original_defaults }
|
||||
before_action :set_currents_for_legacy
|
||||
after_action -> { self.class.reset_original_defaults }
|
||||
|
||||
def configure_defaults_for_user(user)
|
||||
return if !user.is_a?(User) # not for super-admins
|
||||
|
||||
if user.preferred_domain_demarches_gouv_fr?
|
||||
set_currents_for_demarches_gouv_fr
|
||||
else
|
||||
set_currents_for_legacy
|
||||
end
|
||||
|
||||
# Define mailer defaults
|
||||
from = derive_from_header
|
||||
self.class.default from: from, reply_to: from
|
||||
self.class.default_url_options[:host] = Current.host
|
||||
Rails.application.routes.default_url_options[:host] = Current.host
|
||||
|
||||
original_uri = URI.parse(self.class.original_asset_host) # in local with have http://, but https:// in production
|
||||
self.class.asset_host = "#{original_uri.scheme}://#{Current.host}"
|
||||
end
|
||||
|
||||
def configure_defaults_for_email(email)
|
||||
user = User.find_by(email: email)
|
||||
configure_defaults_for_user(user)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_currents_for_demarches_gouv_fr
|
||||
Current.application_name = "demarches.gouv.fr"
|
||||
Current.host = ENV.fetch("APP_HOST")
|
||||
Current.contact_email = "contact@demarches.gouv.fr"
|
||||
Current.no_reply_email = NO_REPLY_EMAIL.sub("demarches-simplifiees.fr", "demarches.gouv.fr") # rubocop:disable DS/ApplicationName
|
||||
end
|
||||
|
||||
def set_currents_for_legacy
|
||||
Current.application_name = APPLICATION_NAME
|
||||
Current.host = ENV["APP_HOST_LEGACY"] || ENV.fetch("APP_HOST") # APP_HOST_LEGACY is optional. Without it, we are in the situation withotu double domains
|
||||
Current.contact_email = CONTACT_EMAIL
|
||||
Current.no_reply_email = NO_REPLY_EMAIL
|
||||
end
|
||||
|
||||
def derive_from_header
|
||||
if self.class.original_default_from.include?(NO_REPLY_EMAIL)
|
||||
Current.no_reply_email
|
||||
else
|
||||
"#{Current.application_name} <#{Current.contact_email}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,22 +3,40 @@ class DeviseUserMailer < Devise::Mailer
|
|||
helper :application # gives access to all helpers defined within `application_helper`.
|
||||
helper MailerHelper
|
||||
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
|
||||
include MailerDefaultsConfigurableConcern
|
||||
include MailerDolistConcern
|
||||
include MailerMonitoringConcern
|
||||
include BalancedDeliveryConcern
|
||||
include PriorityDeliveryConcern
|
||||
|
||||
layout 'mailers/layout'
|
||||
default from: "#{APPLICATION_NAME} <#{CONTACT_EMAIL}>"
|
||||
|
||||
def template_paths
|
||||
['devise_mailer']
|
||||
end
|
||||
|
||||
# Note: this devise hook (like any callback) is called *after* the action,
|
||||
# because we use mailers with Mailer.action_name() syntax
|
||||
# instead of parameterized Mailer.with().action_name.
|
||||
# So any action using Current must manually call `configure_defaults_for_user`
|
||||
def initialize_from_record(record)
|
||||
configure_defaults_for_user(record)
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def confirmation_instructions(record, token, opts = {})
|
||||
opts[:from] = NO_REPLY_EMAIL
|
||||
configure_defaults_for_user(record)
|
||||
|
||||
opts[:from] = Current.no_reply_email
|
||||
opts[:reply_to] = Current.no_reply_email
|
||||
@procedure = opts[:procedure_after_confirmation] || nil
|
||||
@prefill_token = opts[:prefill_token]
|
||||
super
|
||||
|
||||
I18n.with_locale(record.locale) do
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def self.critical_email?(action_name)
|
||||
|
|
|
@ -17,6 +17,8 @@ class DossierMailer < ApplicationMailer
|
|||
|
||||
def notify_new_draft
|
||||
@dossier = params[:dossier]
|
||||
configure_defaults_for_user(@dossier.user)
|
||||
|
||||
I18n.with_locale(@dossier.user_locale) do
|
||||
@service = @dossier.procedure.service
|
||||
@logo_url = procedure_logo_url(@dossier.procedure)
|
||||
|
@ -31,6 +33,8 @@ class DossierMailer < ApplicationMailer
|
|||
def notify_new_answer
|
||||
commentaire = params[:commentaire]
|
||||
dossier = commentaire.dossier
|
||||
configure_defaults_for_user(dossier.user)
|
||||
|
||||
I18n.with_locale(dossier.user_locale) do
|
||||
@dossier = dossier
|
||||
@service = dossier.procedure.service
|
||||
|
@ -45,6 +49,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_new_commentaire_to_instructeur(dossier, instructeur_email)
|
||||
configure_defaults_for_email(instructeur_email)
|
||||
|
||||
I18n.with_locale(dossier.user_locale) do
|
||||
@dossier = dossier
|
||||
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
|
||||
|
@ -56,6 +62,8 @@ class DossierMailer < ApplicationMailer
|
|||
def notify_pending_correction
|
||||
commentaire = params[:commentaire]
|
||||
dossier = commentaire.dossier
|
||||
configure_defaults_for_user(dossier.user)
|
||||
|
||||
I18n.with_locale(dossier.user_locale) do
|
||||
@dossier = dossier
|
||||
@service = dossier.procedure.service
|
||||
|
@ -71,6 +79,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_new_avis_to_instructeur(avis, instructeur_email)
|
||||
configure_defaults_for_email(instructeur_email)
|
||||
|
||||
I18n.with_locale(avis.dossier.user_locale) do
|
||||
@avis = avis
|
||||
@subject = default_i18n_subject(dossier_id: avis.dossier.id, libelle_demarche: avis.procedure.libelle)
|
||||
|
@ -80,6 +90,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_new_dossier_depose_to_instructeur(dossier, instructeur_email)
|
||||
configure_defaults_for_email(instructeur_email)
|
||||
|
||||
I18n.with_locale(dossier.user_locale) do
|
||||
@dossier = dossier
|
||||
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
|
||||
|
@ -89,6 +101,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_brouillon_near_deletion(dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
I18n.with_locale(dossiers.first.user_locale) do
|
||||
@subject = default_i18n_subject(count: dossiers.size)
|
||||
@dossiers = dossiers
|
||||
|
@ -98,6 +112,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_brouillon_deletion(dossier_hashes, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(count: dossier_hashes.size)
|
||||
@dossier_hashes = dossier_hashes
|
||||
|
||||
|
@ -105,6 +121,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_en_construction_deletion_to_administration(dossier, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(dossier_id: dossier.id)
|
||||
@dossier = dossier
|
||||
|
||||
|
@ -112,6 +130,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_deletion_to_administration(deleted_dossier, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(dossier_id: deleted_dossier.dossier_id)
|
||||
@deleted_dossier = deleted_dossier
|
||||
|
||||
|
@ -119,6 +139,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_automatic_deletion_to_user(deleted_dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
I18n.with_locale(deleted_dossiers.first.user_locale) do
|
||||
@state = deleted_dossiers.first.state
|
||||
@subject = default_i18n_subject(count: deleted_dossiers.size)
|
||||
|
@ -129,6 +151,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_automatic_deletion_to_administration(deleted_dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(count: deleted_dossiers.size)
|
||||
@deleted_dossiers = deleted_dossiers
|
||||
|
||||
|
@ -136,6 +160,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_near_deletion_to_user(dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
I18n.with_locale(dossiers.first.user_locale) do
|
||||
@state = dossiers.first.state
|
||||
@subject = default_i18n_subject(count: dossiers.size, state: @state)
|
||||
|
@ -146,6 +172,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_near_deletion_to_administration(dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@state = dossiers.first.state
|
||||
@subject = default_i18n_subject(count: dossiers.size, state: @state)
|
||||
@dossiers = dossiers
|
||||
|
@ -154,6 +182,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_groupe_instructeur_changed(instructeur, dossier)
|
||||
configure_defaults_for_user(instructeur.user)
|
||||
|
||||
@subject = default_i18n_subject(dossier_id: dossier.id)
|
||||
@dossier = dossier
|
||||
|
||||
|
@ -161,6 +191,8 @@ class DossierMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def notify_brouillon_not_submitted(dossier)
|
||||
configure_defaults_for_user(dossier.user)
|
||||
|
||||
I18n.with_locale(dossier.user_locale) do
|
||||
@subject = default_i18n_subject(dossier_id: dossier.id)
|
||||
@dossier = dossier
|
||||
|
@ -172,6 +204,8 @@ class DossierMailer < ApplicationMailer
|
|||
def notify_transfer
|
||||
@transfer = params[:dossier_transfer]
|
||||
|
||||
configure_defaults_for_email(@transfer.email)
|
||||
|
||||
I18n.with_locale(@transfer.user_locale) do
|
||||
@subject = default_i18n_subject()
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class InstructeurMailer < ApplicationMailer
|
|||
def send_login_token(instructeur, login_token)
|
||||
@instructeur_id = instructeur.id
|
||||
@login_token = login_token
|
||||
subject = "Connexion sécurisée à #{APPLICATION_NAME}"
|
||||
subject = "Connexion sécurisée à #{Current.application_name}"
|
||||
|
||||
mail(to: instructeur.email, subject: subject)
|
||||
end
|
||||
|
|
|
@ -28,6 +28,8 @@ class InviteMailer < ApplicationMailer
|
|||
@invite = invite
|
||||
email = invite.email
|
||||
|
||||
configure_defaults_for_email(email)
|
||||
|
||||
mail(to: email,
|
||||
subject: subject,
|
||||
reply_to: reply_to)
|
||||
|
|
|
@ -33,6 +33,8 @@ class NotificationMailer < ApplicationMailer
|
|||
return
|
||||
end
|
||||
|
||||
configure_defaults_for_user(@dossier.user)
|
||||
|
||||
@subject = "Votre dossier rempli par le mandataire #{@dossier.mandataire_first_name} #{@dossier.mandataire_last_name} a été mis à jour"
|
||||
@email = @dossier.individual.email
|
||||
@logo_url = procedure_logo_url(@dossier.procedure)
|
||||
|
@ -78,6 +80,7 @@ class NotificationMailer < ApplicationMailer
|
|||
|
||||
def set_dossier
|
||||
@dossier = params[:dossier]
|
||||
configure_defaults_for_user(@dossier.user)
|
||||
|
||||
if @dossier.skip_user_notification_email?
|
||||
mail.perform_deliveries = false
|
||||
|
|
|
@ -2,19 +2,19 @@ class PreactivateUsersMailer < ApplicationMailer
|
|||
layout 'mailers/layout'
|
||||
|
||||
def reinvite(model, model_name)
|
||||
subject = "Votre compte #{model_name} est activé sur #{APPLICATION_NAME}"
|
||||
subject = "Votre compte #{model_name} est activé sur #{Current.application_name}"
|
||||
signature_separator = "-- "
|
||||
body = <<~END_OF_MAIL
|
||||
Bonjour,
|
||||
|
||||
les activations de compte #{model_name} sur #{APPLICATION_NAME}
|
||||
les activations de compte #{model_name} sur #{Current.application_name}
|
||||
ont connu depuis deux semaines un fonctionnement erratique, et nous
|
||||
pensons que votre inscription sur #{APPLICATION_NAME} a pu s’en
|
||||
pensons que votre inscription sur #{Current.application_name} a pu s’en
|
||||
trouver affectée.
|
||||
|
||||
Nous avons maintenant rétabli un fonctionnement normal de l’activation
|
||||
des comptes. Vous pouvez désormais vous connecter sans encombres à votre
|
||||
compte #{model_name} sur #{APPLICATION_NAME}.
|
||||
compte #{model_name} sur #{Current.application_name}.
|
||||
Si toutefois des difficultés devaient persister, n’hésitez pas à nous
|
||||
en faire part.
|
||||
|
||||
|
@ -22,7 +22,7 @@ class PreactivateUsersMailer < ApplicationMailer
|
|||
|
||||
Cordialement
|
||||
#{signature_separator}
|
||||
L’équipe #{APPLICATION_NAME}
|
||||
L’équipe #{Current.application_name}
|
||||
END_OF_MAIL
|
||||
|
||||
mail(to: model.email,
|
||||
|
|
|
@ -25,7 +25,7 @@ class ResendAttestationMailer < ApplicationMailer
|
|||
|
||||
Cordialement,
|
||||
|
||||
L’équipe #{APPLICATION_NAME}
|
||||
L’équipe #{Current.application_name}
|
||||
HEREDOC
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,8 @@ class UserMailer < ApplicationMailer
|
|||
@subject = "Demande de création de compte"
|
||||
@procedure = procedure
|
||||
|
||||
configure_defaults_for_user(user)
|
||||
|
||||
mail(to: user.email, subject: @subject, procedure: @procedure)
|
||||
end
|
||||
|
||||
|
@ -17,6 +19,8 @@ class UserMailer < ApplicationMailer
|
|||
@requested_email = requested_email
|
||||
@subject = "Fusion de compte"
|
||||
|
||||
configure_defaults_for_email(requested_email)
|
||||
|
||||
mail(to: requested_email, subject: @subject)
|
||||
end
|
||||
|
||||
|
@ -25,6 +29,8 @@ class UserMailer < ApplicationMailer
|
|||
@email_merge_token_created_at = email_merge_token_created_at
|
||||
@subject = "Veuillez confirmer la fusion de compte"
|
||||
|
||||
configure_defaults_for_email(email)
|
||||
|
||||
mail(to: email, subject: @subject)
|
||||
end
|
||||
|
||||
|
@ -33,9 +39,11 @@ class UserMailer < ApplicationMailer
|
|||
@user = user
|
||||
subject = "Activez votre compte instructeur"
|
||||
|
||||
configure_defaults_for_user(user)
|
||||
|
||||
mail(to: user.email,
|
||||
subject: subject,
|
||||
reply_to: CONTACT_EMAIL)
|
||||
reply_to: Current.contact_email)
|
||||
end
|
||||
|
||||
def invite_gestionnaire(user, reset_password_token, groupe_gestionnaire)
|
||||
|
@ -44,12 +52,16 @@ class UserMailer < ApplicationMailer
|
|||
@groupe_gestionnaire = groupe_gestionnaire
|
||||
subject = "Activez votre compte gestionnaire"
|
||||
|
||||
configure_defaults_for_user(user)
|
||||
|
||||
mail(to: user.email,
|
||||
subject: subject,
|
||||
reply_to: CONTACT_EMAIL)
|
||||
reply_to: Current.contact_email)
|
||||
end
|
||||
|
||||
def send_archive(administrateur_or_instructeur, procedure, archive)
|
||||
configure_defaults_for_user(administrateur_or_instructeur.user)
|
||||
|
||||
@archive = archive
|
||||
@procedure = procedure
|
||||
@archive_url = case administrateur_or_instructeur
|
||||
|
@ -71,6 +83,8 @@ class UserMailer < ApplicationMailer
|
|||
@user = user
|
||||
@subject = "Votre compte sera supprimé dans #{Expired::REMAINING_WEEKS_BEFORE_EXPIRATION} semaines"
|
||||
|
||||
configure_defaults_for_user(user)
|
||||
|
||||
mail(to: user.email, subject: @subject)
|
||||
end
|
||||
|
||||
|
@ -80,6 +94,8 @@ class UserMailer < ApplicationMailer
|
|||
@procedure = procedure
|
||||
@content = content
|
||||
|
||||
configure_defaults_for_user(user)
|
||||
|
||||
mail(to: user.email, subject: @subject, content: @content, procedure: @procedure)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
class Current < ActiveSupport::CurrentAttributes
|
||||
attribute :user, :request_id, :browser,
|
||||
:host, :application_name, :contact_email,
|
||||
:application_base_url
|
||||
attribute :application_base_url
|
||||
attribute :application_name
|
||||
attribute :browser
|
||||
attribute :contact_email
|
||||
attribute :host
|
||||
attribute :no_reply_email
|
||||
attribute :request_id
|
||||
attribute :user
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous avez fait la demande d’un compte administrateur sur #{APPLICATION_NAME}.
|
||||
Vous avez fait la demande d’un compte administrateur sur #{Current.application_name}.
|
||||
Votre compte a été créé mais reste inactif, il arrivera à expiration le #{try_format_date(@expiration_date)}
|
||||
|
||||
%p
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
Le règlement général sur la protection des données (RGPD) responsabilise les organismes publics et privés qui traitent leurs données.
|
||||
|
||||
%p
|
||||
Dans le cadre du respect du RGPD, nous (la plateforme #{APPLICATION_NAME}) venons d'activer la suppression automatique des dossiers sur la démarche : "#{@procedure.libelle}".
|
||||
Dans le cadre du respect du RGPD, nous (la plateforme #{Current.application_name}) venons d'activer la suppression automatique des dossiers sur la démarche : "#{@procedure.libelle}".
|
||||
|
||||
%p
|
||||
Vous pouvez d’ores et déjà archiver ces données en accédant à
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
%p
|
||||
Vous êtes administrateur sur la plateforme
|
||||
= APPLICATION_NAME
|
||||
= Current.application_name
|
||||
et au moins un de vos services n'a pas son siret renseigné.
|
||||
|
||||
%p
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%p
|
||||
Un nouvel administrateur a été créé sur #{APPLICATION_NAME}.
|
||||
Un nouvel administrateur a été créé sur #{Current.application_name}.
|
||||
|
||||
%ul
|
||||
%li
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
|
||||
%p
|
||||
Pour les usagers ou les administrations publiques (collectivités, etc.) qui souhaitent remplir une démarche ou déposer un dossier en ligne, l’entrée dans #{APPLICATION_NAME} se fait via un lien fourni par l’administration responsable, sur son propre site web. Ce lien vous permettra de créer un compte et de remplir le formulaire dans la foulée.
|
||||
Pour les usagers ou les administrations publiques (collectivités, etc.) qui souhaitent remplir une démarche ou déposer un dossier en ligne, l’entrée dans #{Current.application_name} se fait via un lien fourni par l’administration responsable, sur son propre site web. Ce lien vous permettra de créer un compte et de remplir le formulaire dans la foulée.
|
||||
|
||||
%p
|
||||
Si par contre vous rencontrez des problèmes lors de l'utilisation de #{APPLICATION_NAME} en tant qu'usager, merci d’expliciter le problème rencontré sur notre
|
||||
Si par contre vous rencontrez des problèmes lors de l'utilisation de #{Current.application_name} en tant qu'usager, merci d’expliciter le problème rencontré sur notre
|
||||
= link_to("formulaire de contact", contact_url)
|
||||
\.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
%p
|
||||
%strong Ce jeton expirera le #{l(@api_token.expires_at, format: :long)}.
|
||||
%br
|
||||
L'accès à l'API de #{APPLICATION_NAME} sera alors bloqué pour ce jeton.
|
||||
L'accès à l'API de #{Current.application_name} sera alors bloqué pour ce jeton.
|
||||
|
||||
%p
|
||||
Pour le renouveler, rendez-vous sur votre page de profil, dans la section « Jetons d’identification de l’API » :
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
- content_for(:footer) do
|
||||
Merci de ne pas répondre à cet email. Donnez votre avis
|
||||
= link_to("sur #{APPLICATION_NAME}", @url)
|
||||
= link_to("sur #{Current.application_name}", @url)
|
||||
ou
|
||||
= succeed '.' do
|
||||
= mail_to(@avis.claimant.email, "contactez la personne qui vous a invité")
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
You have entered your details to create an account on #{APPLICATION_NAME}. To confirm your email and finish creating your account, select the following link:
|
||||
You have entered your details to create an account on #{Current.application_name}. To confirm your email and finish creating your account, select the following link:
|
||||
- link = confirmation_url(@user, confirmation_token: @token, procedure_id: @procedure&.id)
|
||||
= link_to(link, link)
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
To confirm your account email change on #{APPLICATION_NAME}, select the following link:
|
||||
To confirm your account email change on #{Current.application_name}, select the following link:
|
||||
= link_to(confirmation_url(@user, confirmation_token: @token), confirmation_url(@user, confirmation_token: @token))
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
Pour activer votre compte sur #{APPLICATION_NAME}, veuillez cliquer sur le lien suivant :
|
||||
Pour activer votre compte sur #{Current.application_name}, veuillez cliquer sur le lien suivant :
|
||||
- link = confirmation_url(@user, confirmation_token: @token, procedure_id: @procedure&.id, prefill_token: @prefill_token)
|
||||
= link_to(link, link)
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
- unconfirmed_email = @resource.try(:unconfirmed_email?)
|
||||
- if unconfirmed_email.present?
|
||||
%p
|
||||
We recieved a request to change the email address associated with your account #{@email} on #{APPLICATION_NAME}. The new email address will be #{unconfirmed_email}.
|
||||
We recieved a request to change the email address associated with your account #{@email} on #{Current.application_name}. The new email address will be #{unconfirmed_email}.
|
||||
- else
|
||||
%p
|
||||
A change to the email address associated with your account #{@email} was made on #{APPLICATION_NAME}. You can now connect with the email address #{@resource.email}.
|
||||
A change to the email address associated with your account #{@email} was made on #{Current.application_name}. You can now connect with the email address #{@resource.email}.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
- if unconfirmed_email.present?
|
||||
%p
|
||||
Nous avons reçu une demande de changement d’adresse email pour votre
|
||||
compte #{@email} sur #{APPLICATION_NAME}.
|
||||
compte #{@email} sur #{Current.application_name}.
|
||||
Une fois la demande prise en compte, la nouvelle adresse email de
|
||||
votre compte sera #{unconfirmed_email}.
|
||||
- else
|
||||
%p
|
||||
Le changement d’adresse email de votre compte #{@email} sur
|
||||
#{APPLICATION_NAME} a bien été pris en compte.
|
||||
#{Current.application_name} a bien été pris en compte.
|
||||
Vous pouvez désormais vous connecter avec l’adresse #{@resource.email}.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
A request to change your password on #{APPLICATION_NAME} for the account #{@resource.email} was successfully processed.
|
||||
A request to change your password on #{Current.application_name} for the account #{@resource.email} was successfully processed.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
|
||||
%p
|
||||
La demande de changement de mot de passe pour votre compte #{@resource.email} sur
|
||||
#{APPLICATION_NAME} a bien été prise en compte.
|
||||
#{Current.application_name} a bien été prise en compte.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
Someone has requested to change your account password on #{APPLICATION_NAME}. To define a new password, select the following link:
|
||||
Someone has requested to change your account password on #{Current.application_name}. To define a new password, select the following link:
|
||||
|
||||
= round_button 'Change the password', edit_password_url(@resource, reset_password_token: @token), :primary
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
Vous avez demandé à changer votre mot de passe sur #{APPLICATION_NAME}. Pour ceci, merci de cliquer sur le lien suivant :
|
||||
Vous avez demandé à changer votre mot de passe sur #{Current.application_name}. Pour ceci, merci de cliquer sur le lien suivant :
|
||||
|
||||
= round_button 'Changer mon mot de passe', edit_password_url(@resource, reset_password_token: @token), :primary
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
Someone made too many unsuccessful attempts to connect to your account #{@resource.email} on #{APPLICATION_NAME}.
|
||||
Someone made too many unsuccessful attempts to connect to your account #{@resource.email} on #{Current.application_name}.
|
||||
As a security measure, we temporarily locked access to your account.
|
||||
|
||||
%p
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%p
|
||||
Quelqu’un a tenté de se connecter un grand nombre de fois sans succès à votre
|
||||
compte #{@resource.email} sur #{APPLICATION_NAME}. Par mesure de précaution,
|
||||
compte #{@resource.email} sur #{Current.application_name}. Par mesure de précaution,
|
||||
nous avons temporairement désactivé l’accès à votre compte.
|
||||
|
||||
%p
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: APPLICATION_NAME)
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: Current.application_name)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: APPLICATION_NAME)
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: Current.application_name)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: APPLICATION_NAME)
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: Current.application_name)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: APPLICATION_NAME)
|
||||
= t(".email_body", groupe_gestionnaire_name: @groupe_gestionnaire.name, email: @current_super_admin_email, application_name: Current.application_name)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Veuillez cliquer sur le lien sécurisé suivant pour vous connecter à #{APPLICATION_NAME} :
|
||||
Veuillez cliquer sur le lien sécurisé suivant pour vous connecter à #{Current.application_name} :
|
||||
= link_to(sign_in_by_link_url(@instructeur_id, jeton: @login_token), sign_in_by_link_url(@instructeur_id, jeton: @login_token))
|
||||
|
||||
%p
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous avez du nouveau sur #{APPLICATION_NAME} depuis
|
||||
Vous avez du nouveau sur #{Current.application_name} depuis
|
||||
= Date.today.monday? ? "vendredi dernier" : "hier"
|
||||
|
||||
%ul
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous venez d’être nommé instructeur sur #{APPLICATION_NAME}.
|
||||
Vous venez d’être nommé instructeur sur #{Current.application_name}.
|
||||
= "Votre compte (#{@email}) vous donnera désormais aussi accès à l’espace instructeur."
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
= @invite.email_sender
|
||||
souhaite que vous participiez à l’élaboration d’un dossier pour la démarche
|
||||
%strong= @invite.dossier.procedure.libelle
|
||||
sur #{APPLICATION_NAME}.
|
||||
sur #{Current.application_name}.
|
||||
|
||||
- if @invite.message.present?
|
||||
%blockquote
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%p
|
||||
L’utilisateur
|
||||
= @invite.email_sender
|
||||
souhaite que vous participiez à l'élaboration d’un dossier sur #{APPLICATION_NAME}.
|
||||
souhaite que vous participiez à l'élaboration d’un dossier sur #{Current.application_name}.
|
||||
|
||||
- if @invite.message.present?
|
||||
%blockquote
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile, dossier: dossier }
|
||||
- elsif (request.path != new_user_session_path && request.path !=agent_connect_path)
|
||||
- if request.path == new_user_registration_path
|
||||
%li
|
||||
.fr-hidden-sm.fr-unhidden-lg.fr-link--sm= t('views.shared.account.already_user_question')
|
||||
%li.fr-hidden-sm.fr-unhidden-lg.fr-link--sm.fr-mb-2w.fr-mr-1v= t('views.shared.account.already_user_question')
|
||||
%li= link_to 'Agent', agent_connect_path, class: "fr-btn fr-btn--tertiary fr-icon-government-fill fr-btn--icon-left"
|
||||
%li= link_to t('views.shared.account.signin'), new_user_session_path, class: "fr-btn fr-btn--tertiary fr-icon-account-circle-fill fr-btn--icon-left"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Cordialement,
|
|||
= author_name
|
||||
%br
|
||||
%br
|
||||
Équipe #{APPLICATION_NAME}
|
||||
Équipe #{Current.application_name}
|
||||
%br
|
||||
Téléphone (standard) :
|
||||
= CONTACT_PHONE
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
%strong
|
||||
= t('.do_not_reply_html', application_name: APPLICATION_NAME, sender_email: @sender_email)
|
||||
= t('.do_not_reply_html', application_name: Current.application_name, sender_email: @sender_email)
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
- else
|
||||
-# The WORD JOINER unicode entity (⁠) prevents email clients from auto-linking the signature
|
||||
= t('.team')
|
||||
#{APPLICATION_NAME.gsub(".","⁠.").html_safe}
|
||||
#{Current.application_name.gsub(".","⁠.").html_safe}
|
||||
|
|
|
@ -42,23 +42,6 @@
|
|||
<!--[if mso | IE]>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="vertical-align:top;width:396px;">
|
||||
<![endif]-->
|
||||
<div class="mj-column-per-66 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="word-wrap:break-word;font-size:0px;padding:0;padding-top:0px;padding-bottom:0px;" align="left">
|
||||
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;text-align:left;">
|
||||
<img align="middle" alt="Logo <%= "#{APPLICATION_NAME}" %>" src="<%= image_url("#{MAILER_LOGO_SRC}") %>" style="max-width=600px; padding=30px 0; display=inline !important; vertical-align=bottom; border=0; height=auto; outline=none; text-decoration=none; -ms-interpolation-mode=bicubic;" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--[if mso | IE]>
|
||||
</td>
|
||||
<td style="vertical-align:top;width:198px;">
|
||||
<![endif]-->
|
||||
<div class="mj-column-per-33 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
|
||||
|
@ -108,7 +91,20 @@
|
|||
<div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<%= yield(:procedure_logo) %>
|
||||
<%- if content_for?(:procedure_logo) %>
|
||||
<%= yield :procedure_logo %>
|
||||
<%- else -%>
|
||||
<tr>
|
||||
<td style="word-wrap:break-word;font-size:0px;padding:0;padding-top:0px;padding-bottom:0px;" align="left">
|
||||
<p class="" style="cursor:auto;color:#000091;font-family:Helvetica, Arial, sans-serif;font-size:14px;text-align:center">
|
||||
<img align="middle" alt="Logo <%= "#{Current.application_name}" %>" src="<%= image_url(MAILER_LOGO_SRC) %>" style="max-height:100px; padding:15px 30px 15px 30px; vertical-aligne:middle; display:inline !important; border:0; height:auto; outline:none; text-decoration:none; -ms-interpolation-mode:bicubic;" />
|
||||
<b style="font-size:28px;font-weight:600;display:inline-block">
|
||||
<%= Current.application_name %>
|
||||
</b>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<%- end -%>
|
||||
<tr>
|
||||
<td style="word-wrap:break-word;font-size:0px;padding:0px 25px 0px 25px;padding-top:0px;padding-bottom:0px;" align="left">
|
||||
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;">
|
||||
|
@ -168,7 +164,7 @@
|
|||
<tr>
|
||||
<td style="word-wrap:break-word;font-size:0px;padding:0px 20px 0px 20px;padding-top:0px;padding-bottom:0px;" align="center">
|
||||
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:center;">
|
||||
<img align="middle" alt="Logo <%= "#{APPLICATION_NAME}" %>" src="<%= image_url("#{MAILER_FOOTER_LOGO_SRC}") %>" style="max-width=125px; padding=30px 0; display=inline !important; vertical-align=bottom; border=0; height=auto; outline=none; text-decoration=none; -ms-interpolation-mode=bicubic;" />
|
||||
<%= "#{Current.application_name}" %> est un service fourni par <%= t("links.provider.provided_by") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<tr>
|
||||
<td style="word-wrap:break-word;font-size:0px;padding:0px 20px 0px 20px;padding-top:0px;padding-bottom:0px;" align="center">
|
||||
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:center;">
|
||||
<%= "#{APPLICATION_NAME}" %> est un service fourni par <%= t("links.provider.provided_by") %>
|
||||
<%= "#{Current.application_name}" %> est un service fourni par <%= t("links.provider.provided_by") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -26,4 +26,4 @@
|
|||
= t(:best_regards, scope: [:views, :shared, :greetings])
|
||||
%br
|
||||
= t('layouts.mailers.signature.team')
|
||||
#{APPLICATION_NAME.gsub(".","⁠.").html_safe}
|
||||
#{Current.application_name.gsub(".","⁠.").html_safe}
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
%td{ align: "center" }
|
||||
%table{ border:"0", cellspacing:"0", cellpadding:"0" }
|
||||
%tr
|
||||
%td{ align:"center", style:"border-radius: 5px;", color: theme[:color], bgcolor: theme[:bg_color] }
|
||||
%a{ href: url, target:"_blank", rel: "noopener", style:"font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #{theme[:color]}; text-decoration: none; text-decoration: none; border-radius: 5px; padding: 12px 25px; border: 1px solid #{theme[:border_color]}; display: inline-block; min-width: 250px" }
|
||||
%td{ align:"center", color: theme[:color], bgcolor: theme[:bg_color] }
|
||||
%a{ href: url, target:"_blank", rel: "noopener", style:"font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #{theme[:color]}; text-decoration: none; text-decoration: none; padding: 8px 24px; border: 1px solid #{theme[:border_color]}; display: inline-block; min-width: 200px; min-height: 32px; line-height: 32px;" }
|
||||
= text
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous venez d’être nommé gestionnaire du groupe gestionnaire #{@groupe_gestionnaire.name} sur #{APPLICATION_NAME}.
|
||||
Vous venez d’être nommé gestionnaire du groupe gestionnaire #{@groupe_gestionnaire.name} sur #{Current.application_name}.
|
||||
|
||||
%p
|
||||
Votre compte a été créé pour l'adresse email #{@user.email}. Pour l’activer, nous vous invitons à cliquer sur le lien suivant :
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Vous venez d’être nommé instructeur sur #{APPLICATION_NAME}.
|
||||
Vous venez d’être nommé instructeur sur #{Current.application_name}.
|
||||
|
||||
%p
|
||||
Votre compte a été créé pour l'adresse email
|
||||
|
@ -15,7 +15,7 @@
|
|||
= link_to(users_activate_url(token: @reset_password_token), users_activate_url(token: @reset_password_token))
|
||||
|
||||
%p
|
||||
Lors de vos prochaines connexions sur #{APPLICATION_NAME} cliquez sur le bouton « Se connecter » positionné sur le haut de page ou bien sur ce lien :
|
||||
Lors de vos prochaines connexions sur #{Current.application_name} cliquez sur le bouton « Se connecter » positionné sur le haut de page ou bien sur ce lien :
|
||||
= link_to new_user_session_url, new_user_session_url
|
||||
|
||||
- if AgentConnectService.enabled?
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Une demande de création de compte a été réalisée sur le site #{APPLICATION_NAME} pour l'email #{@user.email}.
|
||||
Une demande de création de compte a été réalisée sur le site #{Current.application_name} pour l'email #{@user.email}.
|
||||
|
||||
%p
|
||||
%strong Votre compte existe déjà.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Bonjour,
|
||||
|
||||
%p
|
||||
Cela fait plus de deux ans que vous ne vous êtes pas connecté à #{APPLICATION_NAME}.
|
||||
Cela fait plus de deux ans que vous ne vous êtes pas connecté à #{Current.application_name}.
|
||||
- if @user.dossiers.not_brouillon.count == 0
|
||||
Aussi vous n'avez plus de dossier sur la plateforme.
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"type": "controller",
|
||||
"class": "Users::DossiersController",
|
||||
"method": "merci",
|
||||
"line": 291,
|
||||
"line": 302,
|
||||
"file": "app/controllers/users/dossiers_controller.rb",
|
||||
"rendered": {
|
||||
"name": "users/dossiers/merci",
|
||||
|
@ -44,40 +44,6 @@
|
|||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Cross-Site Scripting",
|
||||
"warning_code": 2,
|
||||
"fingerprint": "42099f4550a8377f455e830e8ab645cecd5806248481c5c646b4e17548c3cb07",
|
||||
"check_name": "CrossSiteScripting",
|
||||
"message": "Unescaped model attribute",
|
||||
"file": "app/views/france_connect/particulier/merge.html.haml",
|
||||
"line": 6,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
|
||||
"code": "t(\".subtitle\", :email => sanitize(FranceConnectInformation.find_by(:merge_token => merge_token_params).email_france_connect), :application_name => (APPLICATION_NAME))",
|
||||
"render_path": [
|
||||
{
|
||||
"type": "controller",
|
||||
"class": "FranceConnect::ParticulierController",
|
||||
"method": "merge",
|
||||
"line": 47,
|
||||
"file": "app/controllers/france_connect/particulier_controller.rb",
|
||||
"rendered": {
|
||||
"name": "france_connect/particulier/merge",
|
||||
"file": "app/views/france_connect/particulier/merge.html.haml"
|
||||
}
|
||||
}
|
||||
],
|
||||
"location": {
|
||||
"type": "template",
|
||||
"template": "france_connect/particulier/merge"
|
||||
},
|
||||
"user_input": "FranceConnectInformation.find_by(:merge_token => merge_token_params).email_france_connect",
|
||||
"confidence": "Weak",
|
||||
"cwe_id": [
|
||||
79
|
||||
],
|
||||
"note": "explicitely sanitized even if we are using html_safe"
|
||||
},
|
||||
{
|
||||
"warning_type": "SQL Injection",
|
||||
"warning_code": 0,
|
||||
|
@ -85,7 +51,7 @@
|
|||
"check_name": "SQL",
|
||||
"message": "Possible SQL injection",
|
||||
"file": "app/graphql/connections/cursor_connection.rb",
|
||||
"line": 66,
|
||||
"line": 150,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
|
||||
"code": "items.order(order_column => ((:desc or :asc)), :id => ((:desc or :asc))).limit(limit).where(\"(#{order_table}.#{order_column}, #{order_table}.id) < (?, ?)\", timestamp, id)",
|
||||
"render_path": null,
|
||||
|
@ -108,7 +74,7 @@
|
|||
"check_name": "SQL",
|
||||
"message": "Possible SQL injection",
|
||||
"file": "app/graphql/connections/cursor_connection.rb",
|
||||
"line": 69,
|
||||
"line": 153,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
|
||||
"code": "items.order(order_column => ((:desc or :asc)), :id => ((:desc or :asc))).limit(limit).where(\"(#{order_table}.#{order_column}, #{order_table}.id) > (?, ?)\", timestamp, id)",
|
||||
"render_path": null,
|
||||
|
@ -146,8 +112,63 @@
|
|||
89
|
||||
],
|
||||
"note": "The table and column are escaped, which should make this safe"
|
||||
},
|
||||
{
|
||||
"warning_type": "Cross-Site Scripting",
|
||||
"warning_code": 2,
|
||||
"fingerprint": "c97049798ff05438dcca6f3ee1a714f2336041837411ab001a7e3caf1bfb75c8",
|
||||
"check_name": "CrossSiteScripting",
|
||||
"message": "Unescaped model attribute",
|
||||
"file": "app/views/layouts/mailers/_signature.html.haml",
|
||||
"line": 9,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
|
||||
"code": "Current.application_name.gsub(\".\", \"⁠.\")",
|
||||
"render_path": [
|
||||
{
|
||||
"type": "template",
|
||||
"name": "administrateur_mailer/api_token_expiration",
|
||||
"line": 19,
|
||||
"file": "app/views/administrateur_mailer/api_token_expiration.haml",
|
||||
"rendered": {
|
||||
"name": "layouts/mailers/_signature",
|
||||
"file": "app/views/layouts/mailers/_signature.html.haml"
|
||||
}
|
||||
}
|
||||
],
|
||||
"location": {
|
||||
"type": "template",
|
||||
"template": "layouts/mailers/_signature"
|
||||
},
|
||||
"user_input": null,
|
||||
"confidence": "Medium",
|
||||
"cwe_id": [
|
||||
79
|
||||
],
|
||||
"note": "Current is not a model"
|
||||
},
|
||||
{
|
||||
"warning_type": "Cross-Site Scripting",
|
||||
"warning_code": 2,
|
||||
"fingerprint": "f74cfb12b3183f456594e809f222bb2723cc232aa5b8f5f7d9bd6d493c1521fb",
|
||||
"check_name": "CrossSiteScripting",
|
||||
"message": "Unescaped model attribute",
|
||||
"file": "app/views/notification_mailer/send_notification_for_tiers.html.haml",
|
||||
"line": 29,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
|
||||
"code": "Current.application_name.gsub(\".\", \"⁠.\")",
|
||||
"render_path": null,
|
||||
"location": {
|
||||
"type": "template",
|
||||
"template": "notification_mailer/send_notification_for_tiers"
|
||||
},
|
||||
"user_input": null,
|
||||
"confidence": "Medium",
|
||||
"cwe_id": [
|
||||
79
|
||||
],
|
||||
"note": "Current is not a model"
|
||||
}
|
||||
],
|
||||
"updated": "2023-08-28 12:16:04 +0200",
|
||||
"brakeman_version": "5.4.1"
|
||||
"updated": "2024-03-27 17:15:54 +0100",
|
||||
"brakeman_version": "6.1.2"
|
||||
}
|
||||
|
|
|
@ -82,10 +82,7 @@ DS_ENV="staging"
|
|||
# HEADER_LOGO_HEIGHT="56"
|
||||
|
||||
# Instance customization: Emails header logo ---> to be put in "app/assets/images"
|
||||
# MAILER_LOGO_SRC="mailer/instructeur_mailer/logo.png"
|
||||
|
||||
# Instance customization: Emails footer logo ---> to be put in "app/assets/images"
|
||||
# MAILER_FOOTER_LOGO_SRC="mailer/instructeur_mailer/logo-beta-gouv-fr.png"
|
||||
# MAILER_LOGO_SRC="mailer/republique-francaise-logo.png"
|
||||
|
||||
# Instance customization: Procedure default logo ---> to be put in "app/assets/images"
|
||||
# PROCEDURE_DEFAULT_LOGO_SRC="republique-francaise-logo.svg"
|
||||
|
|
|
@ -63,9 +63,10 @@ Rails.application.configure do
|
|||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||
config.action_mailer.default_url_options = { host: ENV.fetch("APP_HOST") }
|
||||
config.action_mailer.asset_host = "http://" + ENV.fetch("APP_HOST")
|
||||
Rails.application.routes.default_url_options = {
|
||||
host: 'localhost:3000',
|
||||
host: ENV.fetch("APP_HOST"),
|
||||
protocol: :http
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ HEADER_LOGO_WIDTH = ENV.fetch("HEADER_LOGO_WIDTH", "65")
|
|||
HEADER_LOGO_HEIGHT = ENV.fetch("HEADER_LOGO_HEIGHT", "56")
|
||||
|
||||
# Mailer logos
|
||||
MAILER_LOGO_SRC = ENV.fetch("MAILER_LOGO_SRC", "mailer/instructeur_mailer/logo.png")
|
||||
MAILER_FOOTER_LOGO_SRC = ENV.fetch("MAILER_FOOTER_LOGO_SRC", "mailer/instructeur_mailer/logo-beta-gouv-fr.png")
|
||||
MAILER_LOGO_SRC = ENV.fetch("MAILER_LOGO_SRC", "mailer/republique-francaise-logo.png")
|
||||
|
||||
# Default logo of a procedure
|
||||
PROCEDURE_DEFAULT_LOGO_SRC = ENV.fetch("PROCEDURE_DEFAULT_LOGO_SRC", "republique-francaise-logo.svg")
|
||||
|
|
|
@ -8,10 +8,10 @@ if ENV.fetch('MAILTRAP_ENABLED') == 'enabled'
|
|||
ActionMailer::Base.mailtrap_settings = {
|
||||
user_name: Rails.application.secrets.mailtrap[:username],
|
||||
password: Rails.application.secrets.mailtrap[:password],
|
||||
address: 'smtp.mailtrap.io',
|
||||
domain: 'smtp.mailtrap.io',
|
||||
address: 'sandbox.smtp.mailtrap.io',
|
||||
domain: 'sandbox.smtp.mailtrap.io',
|
||||
port: '2525',
|
||||
authentication: :cram_md5
|
||||
authentication: :login
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,8 +16,71 @@ RSpec.describe DeviseUserMailer, type: :mailer do
|
|||
|
||||
context 'when perform_later is called' do
|
||||
it 'enqueues email in default queue for high priority delivery' do
|
||||
expect { subject.deliver_later }.to have_enqueued_job.on_queue(Rails.application.config.action_mailer.deliver_later_queue_name)
|
||||
end
|
||||
expect { subject.deliver_later }.to have_enqueued_job.on_queue(Rails.application.config.action_mailer.deliver_later_queue_name)
|
||||
end
|
||||
end
|
||||
|
||||
describe "i18n" do
|
||||
context "when locale is fr" do
|
||||
let(:user) { create(:user, locale: :fr) }
|
||||
|
||||
it "uses fr locale" do
|
||||
expect(subject.body).to include("Activez votre compte")
|
||||
end
|
||||
end
|
||||
|
||||
context "when locale is en" do
|
||||
let(:user) { create(:user, locale: :en) }
|
||||
|
||||
it "uses en locale" do
|
||||
expect(subject.body).to include("Activate account")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'headers for user' do
|
||||
context "confirmation email" do
|
||||
subject { described_class.confirmation_instructions(user, token, opts = {}) }
|
||||
|
||||
context "legacy domain" do
|
||||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to eq(NO_REPLY_EMAIL)
|
||||
expect(header_value("Reply-To", subject.message)).to eq(NO_REPLY_EMAIL)
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST_LEGACY")}/users/confirmation")
|
||||
end
|
||||
end
|
||||
|
||||
context "new domain" do
|
||||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to eq("Ne pas répondre <ne-pas-repondre@demarches.gouv.fr>")
|
||||
expect(header_value("Reply-To", subject.message)).to eq("Ne pas répondre <ne-pas-repondre@demarches.gouv.fr>")
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST")}/users/confirmation")
|
||||
expect(subject.message.to_s).to include("//#{ENV.fetch("APP_HOST")}/assets/mailer/republique")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "reset password instructions" do
|
||||
subject { described_class.reset_password_instructions(user, token) }
|
||||
|
||||
context "legacy domain" do
|
||||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to include(CONTACT_EMAIL)
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST_LEGACY")}/users/password")
|
||||
end
|
||||
end
|
||||
|
||||
context "new domain" do
|
||||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to include("@demarches.gouv.fr")
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST")}/users/password")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,18 +12,30 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
end
|
||||
|
||||
describe '.notify_new_draft' do
|
||||
let(:dossier) { create(:dossier, procedure: create(:simple_procedure, :with_auto_archive)) }
|
||||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, procedure: create(:simple_procedure, :with_auto_archive), user:) }
|
||||
|
||||
subject { described_class.with(dossier:).notify_new_draft }
|
||||
|
||||
it { expect(subject.subject).to include("brouillon") }
|
||||
it { expect(subject.subject).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include(dossier_url(dossier)) }
|
||||
it { expect(subject.body).to include("Vous pouvez déposer votre dossier jusqu’au") }
|
||||
it { expect(subject.body).to include("heure de") }
|
||||
it 'includes the correct subject and body content' do
|
||||
expect(subject.subject).to include("brouillon")
|
||||
expect(subject.subject).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include(dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
expect(subject.body).to include("Vous pouvez déposer votre dossier jusqu’au")
|
||||
expect(subject.body).to include("heure de")
|
||||
end
|
||||
|
||||
it_behaves_like 'a dossier notification'
|
||||
|
||||
context "when user prefers new domain" do
|
||||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it 'includes the correct body content and sender email' do
|
||||
expect(subject.body).to include(dossier_url(dossier, host: ENV.fetch('APP_HOST')))
|
||||
expect(header_value("From", subject)).to include("ne-pas-repondre@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_new_answer with dossier brouillon' do
|
||||
|
@ -33,10 +45,12 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
let(:commentaire) { create(:commentaire, dossier: dossier) }
|
||||
subject { described_class.with(commentaire: commentaire).notify_new_answer }
|
||||
|
||||
it { expect(subject.subject).to include("Nouveau message") }
|
||||
it { expect(subject.subject).to include(dossier.id.to_s) }
|
||||
it { expect(subject.body).to include(dossier.procedure.service.email) }
|
||||
it { expect(subject.body).not_to include(messagerie_dossier_url(dossier)) }
|
||||
it 'checks email subject and body for correct inclusions and exclusions' do
|
||||
expect(subject.subject).to include("Nouveau message")
|
||||
expect(subject.subject).to include(dossier.id.to_s)
|
||||
expect(subject.body).to include(dossier.procedure.service.email)
|
||||
expect(subject.body).not_to include(messagerie_dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
|
||||
it_behaves_like 'a dossier notification'
|
||||
|
||||
|
@ -52,9 +66,11 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.with(commentaire: commentaire).notify_new_answer }
|
||||
|
||||
it { expect(subject.subject).to include("Nouveau message") }
|
||||
it { expect(subject.subject).to include(dossier.id.to_s) }
|
||||
it { expect(subject.body).to include(messagerie_dossier_url(dossier)) }
|
||||
it 'checks email subject and body for correct inclusions' do
|
||||
expect(subject.subject).to include("Nouveau message")
|
||||
expect(subject.subject).to include(dossier.id.to_s)
|
||||
expect(subject.body).to include(messagerie_dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
|
||||
it_behaves_like 'a dossier notification'
|
||||
end
|
||||
|
@ -80,10 +96,12 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_deletion_to_administration(deleted_dossier, to_email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Le dossier nº #{deleted_dossier.dossier_id} a été supprimé à la demande de l’usager") }
|
||||
it { expect(subject.body).to include("À la demande de l’usager") }
|
||||
it { expect(subject.body).to include(deleted_dossier.dossier_id) }
|
||||
it { expect(subject.body).to include(deleted_dossier.procedure.libelle) }
|
||||
it 'verifies subject and body content for deletion notification' do
|
||||
expect(subject.subject).to eq("Le dossier nº #{deleted_dossier.dossier_id} a été supprimé à la demande de l’usager")
|
||||
expect(subject.body).to include("À la demande de l’usager")
|
||||
expect(subject.body).to include(deleted_dossier.dossier_id)
|
||||
expect(subject.body).to include(deleted_dossier.procedure.libelle)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_brouillon_near_deletion' do
|
||||
|
@ -91,8 +109,10 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_brouillon_near_deletion([dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.body).to include("n° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it 'checks email body for correct inclusions regarding brouillon nearing deletion' do
|
||||
expect(subject.body).to include("n° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_brouillon_deletion' do
|
||||
|
@ -100,8 +120,10 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_brouillon_deletion([dossier.hash_for_deletion_mail], dossier.user.email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Un dossier en brouillon a été supprimé automatiquement") }
|
||||
it { expect(subject.body).to include("n° #{dossier.id} (#{dossier.procedure.libelle})") }
|
||||
it 'verifies subject and body content for brouillon deletion notification' do
|
||||
expect(subject.subject).to eq("Un dossier en brouillon a été supprimé automatiquement")
|
||||
expect(subject.body).to include("n° #{dossier.id} (#{dossier.procedure.libelle})")
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_automatic_deletion_to_user' do
|
||||
|
@ -112,11 +134,13 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_automatic_deletion_to_user([deleted_dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.to).to eq([dossier.user.email]) }
|
||||
it { expect(subject.subject).to eq("Un dossier a été supprimé automatiquement de votre compte") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include("nous nous excusons de la gêne occasionnée") }
|
||||
it 'checks email subject, to, and body for correct inclusions and exclusions for en_construction status' do
|
||||
expect(subject.to).to eq([dossier.user.email])
|
||||
expect(subject.subject).to eq("Un dossier a été supprimé automatiquement de votre compte")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include("nous nous excusons de la gêne occasionnée")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'termine' do
|
||||
|
@ -124,11 +148,13 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_automatic_deletion_to_user([deleted_dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.to).to eq([dossier.user.email]) }
|
||||
it { expect(subject.subject).to eq("Un dossier a été supprimé automatiquement de votre compte") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).not_to include("nous nous excusons de la gène occasionnée") }
|
||||
it 'checks email subject, to, and body for correct inclusions and exclusions for termine status' do
|
||||
expect(subject.to).to eq([dossier.user.email])
|
||||
expect(subject.subject).to eq("Un dossier a été supprimé automatiquement de votre compte")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).not_to include("nous nous excusons de la gêne occasionnée")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -138,8 +164,10 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_automatic_deletion_to_administration([deleted_dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Un dossier a été supprimé automatiquement") }
|
||||
it { expect(subject.body).to include("n° #{dossier.id} (#{dossier.procedure.libelle})") }
|
||||
it 'verifies subject and body content for automatic deletion notification' do
|
||||
expect(subject.subject).to eq("Un dossier a été supprimé automatiquement")
|
||||
expect(subject.body).to include("n° #{dossier.id} (#{dossier.procedure.libelle})")
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_near_deletion_to_administration' do
|
||||
|
@ -148,11 +176,13 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_near_deletion_to_administration([dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Un dossier en construction va bientôt être supprimé") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include("PDF") }
|
||||
it { expect(subject.body).to include("Vous avez <b>14 jours</b> pour commencer l’instruction du dossier.") }
|
||||
it 'checks email subject and body for correct inclusions for en_construction status' do
|
||||
expect(subject.subject).to eq("Un dossier en construction va bientôt être supprimé")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include("PDF")
|
||||
expect(subject.body).to include("Vous avez <b>14 jours</b> pour commencer l’instruction du dossier.")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'termine' do
|
||||
|
@ -160,9 +190,11 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_near_deletion_to_administration([dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Un dossier dont le traitement est terminé va bientôt être supprimé") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it 'verifies subject and body content for near deletion notification of completed cases' do
|
||||
expect(subject.subject).to eq("Un dossier dont le traitement est terminé va bientôt être supprimé")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -172,12 +204,14 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_near_deletion_to_user([dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.to).to eq([dossier.user.email]) }
|
||||
it { expect(subject.subject).to eq("Un dossier en construction va bientôt être supprimé") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include("Votre compte reste activé") }
|
||||
it { expect(subject.body).to include("Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans l’interface.") }
|
||||
it 'verifies email subject, to, and body for correct inclusions for en_construction status' do
|
||||
expect(subject.to).to eq([dossier.user.email])
|
||||
expect(subject.subject).to eq("Un dossier en construction va bientôt être supprimé")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include("Votre compte reste activé")
|
||||
expect(subject.body).to include("Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans l’interface.")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'termine' do
|
||||
|
@ -185,12 +219,14 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_near_deletion_to_user([dossier], dossier.user.email) }
|
||||
|
||||
it { expect(subject.to).to eq([dossier.user.email]) }
|
||||
it { expect(subject.subject).to eq("Un dossier dont le traitement est terminé va bientôt être supprimé") }
|
||||
it { expect(subject.body).to include("N° #{dossier.id} ") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include("Votre compte reste activé") }
|
||||
it { expect(subject.body).to include("PDF") }
|
||||
it 'checks email subject, to, and body for correct inclusions for termine status' do
|
||||
expect(subject.to).to eq([dossier.user.email])
|
||||
expect(subject.subject).to eq("Un dossier dont le traitement est terminé va bientôt être supprimé")
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include("Votre compte reste activé")
|
||||
expect(subject.body).to include("PDF")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'multiple termines' do
|
||||
|
@ -198,10 +234,12 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_near_deletion_to_user(dossiers, dossiers[0].user.email) }
|
||||
|
||||
it { expect(subject.subject).to eq("Des dossiers dont le traitement est terminé vont bientôt être supprimés") }
|
||||
it { expect(subject.body).to include("N° #{dossiers[0].id} ") }
|
||||
it { expect(subject.body).to include("N° #{dossiers[1].id} ") }
|
||||
it { expect(subject.body).to include("N° #{dossiers[2].id} ") }
|
||||
it 'verifies email subject and body contain correct dossier numbers for multiple termine status' do
|
||||
expect(subject.subject).to eq("Des dossiers dont le traitement est terminé vont bientôt être supprimés")
|
||||
dossiers.each do |dossier|
|
||||
expect(subject.body).to include("N° #{dossier.id} ")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -211,10 +249,12 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
|
||||
subject { described_class.notify_groupe_instructeur_changed(instructeur, dossier) }
|
||||
|
||||
it { expect(subject.subject).to eq("Le dossier nº #{dossier.id} a changé de groupe d’instructeurs") }
|
||||
it { expect(subject.body).to include("n° #{dossier.id}") }
|
||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||
it { expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.") }
|
||||
it 'verifies subject and body content for groupe instructeur change notification' do
|
||||
expect(subject.subject).to eq("Le dossier nº #{dossier.id} a changé de groupe d’instructeurs")
|
||||
expect(subject.body).to include("n° #{dossier.id}")
|
||||
expect(subject.body).to include(dossier.procedure.libelle)
|
||||
expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.")
|
||||
end
|
||||
end
|
||||
|
||||
describe '.notify_pending_correction' do
|
||||
|
@ -230,19 +270,23 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
}
|
||||
|
||||
context 'reason is incorrect' do
|
||||
it { expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »") }
|
||||
it { expect(subject.body).to include("apporter des corrections") }
|
||||
it { expect(subject.body).not_to include("Silence") }
|
||||
it 'checks email subject and body for corrections without Silence Vaut Accord' do
|
||||
expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »")
|
||||
expect(subject.body).to include("apporter des corrections")
|
||||
expect(subject.body).not_to include("Silence")
|
||||
end
|
||||
end
|
||||
|
||||
context 'sva with reason is incorrect' do
|
||||
let(:sva_svr_decision_on) { Date.tomorrow }
|
||||
let(:procedure) { create(:procedure, :sva) }
|
||||
|
||||
it { expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »") }
|
||||
it { expect(subject.body).to include("apporter des corrections") }
|
||||
it { expect(subject.body).to include("Silence Vaut Accord") }
|
||||
it { expect(subject.body).to include("suspendu") }
|
||||
it 'includes Silence Vaut Accord and mentions suspension for incorrect reason' do
|
||||
expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »")
|
||||
expect(subject.body).to include("apporter des corrections")
|
||||
expect(subject.body).to include("Silence Vaut Accord")
|
||||
expect(subject.body).to include("suspendu")
|
||||
end
|
||||
end
|
||||
|
||||
context 'sva with reason is incomplete' do
|
||||
|
@ -250,9 +294,11 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
let(:reason) { :incomplete }
|
||||
let(:procedure) { create(:procedure, :sva) }
|
||||
|
||||
it { expect(subject.body).to include("compléter") }
|
||||
it { expect(subject.body).to include("Silence Vaut Accord") }
|
||||
it { expect(subject.body).to include("réinitialisé") }
|
||||
it 'mentions the need to complete the dossier and includes Silence Vaut Accord with reset message' do
|
||||
expect(subject.body).to include("compléter")
|
||||
expect(subject.body).to include("Silence Vaut Accord")
|
||||
expect(subject.body).to include("réinitialisé")
|
||||
end
|
||||
end
|
||||
|
||||
context 'svr with reason is incomplete' do
|
||||
|
@ -260,9 +306,11 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
let(:reason) { :incomplete }
|
||||
let(:procedure) { create(:procedure, :svr) }
|
||||
|
||||
it { expect(subject.body).to include("compléter") }
|
||||
it { expect(subject.body).to include("Silence Vaut Rejet") }
|
||||
it { expect(subject.body).to include("réinitialisé") }
|
||||
it 'mentions the need to complete the dossier and includes Silence Vaut Rejet with reset message' do
|
||||
expect(subject.body).to include("compléter")
|
||||
expect(subject.body).to include("Silence Vaut Rejet")
|
||||
expect(subject.body).to include("réinitialisé")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -275,15 +323,26 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
subject { described_class.with(dossier_transfer: dossier_transfer).notify_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) }
|
||||
it 'includes relevant details about the single dossier transfer request' do
|
||||
expect(subject.subject).to include("Vous avez une demande de transfert en attente.")
|
||||
expect(subject.body).to include("#{user.email} vous adresse une demande de transfert pour le dossier n° #{dossier.id} sur la démarche")
|
||||
expect(subject.body).to include(procedure.libelle.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when recipient has preferred domain' do
|
||||
let(:dossier_transfer) { create(:dossier_transfer, email: create(:user, preferred_domain: :demarches_gouv_fr).email) }
|
||||
it 'includes a link with the preferred domain in the email body' do
|
||||
expect(subject.body).to include(dossiers_url(statut: "dossiers-transferes", host: ENV.fetch("APP_HOST")))
|
||||
end
|
||||
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.") }
|
||||
it 'includes a summary of multiple dossiers transfer request' do
|
||||
expect(subject.subject).to include("Vous avez une demande de transfert en attente.")
|
||||
expect(subject.body).to include("#{user.email} vous adresse une demande de transfert pour 2 dossiers.")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it is a transfer of one dossier from super admin' do
|
||||
|
@ -291,8 +350,10 @@ RSpec.describe DossierMailer, type: :mailer 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") }
|
||||
it 'includes details indicating the transfer request is from support' do
|
||||
expect(subject.subject).to include("Vous avez une demande de transfert en attente.")
|
||||
expect(subject.body).to include("Le support technique vous adresse une demande de transfert")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossiers have been dissociated from transfer' do
|
||||
|
|
|
@ -8,10 +8,12 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
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é déposé 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>.") }
|
||||
it 'verifies email subject, recipient, and body content for updated dossier by mandataire' do
|
||||
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")
|
||||
expect(subject.to).to eq([dossier_for_tiers.individual.email])
|
||||
expect(subject.body).to include("a été déposé le")
|
||||
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
|
||||
end
|
||||
|
||||
describe 'send_notification_for_tiers for repasser_en_instruction' do
|
||||
|
@ -19,10 +21,12 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
subject { described_class.send_notification_for_tiers(dossier_for_tiers, repasser_en_instruction: true) }
|
||||
|
||||
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("va être réexaminé, la précédente décision sur ce dossier est caduque.") }
|
||||
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>.") }
|
||||
it 'verifies email subject, recipient, and body content for dossier re-examination notification' do
|
||||
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")
|
||||
expect(subject.to).to eq([dossier_for_tiers.individual.email])
|
||||
expect(subject.body).to include("va être réexaminé, la précédente décision sur ce dossier est caduque.")
|
||||
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
|
||||
end
|
||||
|
||||
describe 'send_en_construction_notification' do
|
||||
|
@ -66,37 +70,40 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
subject(:mail) { described_class.send_en_instruction_notification(dossier) }
|
||||
|
||||
it 'renders the template' do
|
||||
it 'renders the template with subject and body' do
|
||||
expect(mail.subject).to eq('Email subject')
|
||||
expect(mail.body).to include('Your dossier was processed')
|
||||
expect(mail.body).to have_link('messagerie')
|
||||
end
|
||||
|
||||
it 'renders the actions' do
|
||||
expect(mail.body).to have_link('Consulter mon dossier', href: dossier_url(dossier))
|
||||
expect(mail.body).to have_link('J’ai une question', href: messagerie_dossier_url(dossier))
|
||||
it 'renders the actions with links to dossier and messagerie' do
|
||||
expect(mail.body).to have_link('Consulter mon dossier', href: dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
expect(mail.body).to have_link('J’ai une question', href: messagerie_dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
|
||||
context 'when the template body contains tags' do
|
||||
let(:email_template) { create(:received_mail, subject: 'Email subject', body: 'Hello --nom--, your dossier --lien dossier-- was processed.', procedure:) }
|
||||
|
||||
it 'replaces value tags with the proper value' do
|
||||
expect(mail.body).to have_content(dossier.individual.nom)
|
||||
it 'replaces value tags with the proper value and renders links correctly' do
|
||||
expect(mail.body).to include(dossier.individual.nom)
|
||||
expect(mail.body).to have_link(href: dossier_url(dossier, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
|
||||
it 'replaces link tags with a clickable link' do
|
||||
expect(mail.body).to have_link(dossier_url(dossier))
|
||||
context "when user has preferred domain" do
|
||||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it 'adjusts links and sender email for user preferred domain' do
|
||||
expect(mail.body).to have_link(href: dossier_url(dossier, host: ENV.fetch("APP_HOST")))
|
||||
expect(header_value("From", mail)).to include("@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the template body contains HTML' do
|
||||
let(:email_template) { create(:received_mail, body: 'Your <b>dossier</b> was processed. <iframe src="#">Foo</iframe>', procedure:) }
|
||||
|
||||
it 'allows basic formatting tags' do
|
||||
it 'allows basic formatting tags but sanitizes sensitive content' do
|
||||
expect(mail.body).to include('<b>dossier</b>')
|
||||
end
|
||||
|
||||
it 'sanitizes sensitive content' do
|
||||
expect(mail.body).not_to include('iframe')
|
||||
end
|
||||
end
|
||||
|
@ -117,15 +124,17 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
subject(:mail) { described_class.send_accepte_notification(dossier) }
|
||||
|
||||
context "subject is too long" do
|
||||
context "when the subject is too long" do
|
||||
let(:subject) { 'Un long libellé --libellé démarche--' }
|
||||
it { expect(mail.subject.length).to be <= 100 }
|
||||
end
|
||||
|
||||
context "subject should fallback to default" do
|
||||
context "when the subject should fallback to default" do
|
||||
let(:subject) { "" }
|
||||
it { expect(mail.subject).to match(/^Votre dossier .+ a été accepté \(My super long title/) }
|
||||
it { expect(mail.subject.length).to be <= 100 }
|
||||
it 'provides a default subject within the length limit including procedure title beginning' do
|
||||
expect(mail.subject).to match(/^Votre dossier .+ a été accepté \(My super long title/)
|
||||
expect(mail.subject.length).to be <= 100
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -140,9 +149,11 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
subject(:mail) { described_class.send_en_instruction_notification(dossier) }
|
||||
|
||||
context "subject has a special character should not be escaped" do
|
||||
context "when the subject has a special character that should not be escaped" do
|
||||
let(:subject) { '--libellé démarche--' }
|
||||
it { expect(mail.subject).to eq("Mon titre avec l'apostrophe") }
|
||||
it 'includes the apostrophe without escaping it' do
|
||||
expect(mail.subject).to eq("Mon titre avec l'apostrophe")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,16 +4,27 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
describe '.new_account_warning' do
|
||||
subject { described_class.new_account_warning(user) }
|
||||
|
||||
it { expect(subject.to).to eq([user.email]) }
|
||||
it { expect(subject.body).to include(user.email) }
|
||||
it { expect(subject.body).to have_link('J’ai oublié mon mot de passe') }
|
||||
it 'sends email to the correct user with expected body content and link' do
|
||||
expect(subject.to).to eq([user.email])
|
||||
expect(subject.body).to include(user.email)
|
||||
expect(subject.body).to have_link('J’ai oublié mon mot de passe')
|
||||
end
|
||||
|
||||
context 'when a procedure is provided' do
|
||||
let(:procedure) { build(:procedure) }
|
||||
|
||||
subject { described_class.new_account_warning(user, procedure) }
|
||||
|
||||
it { expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path)) }
|
||||
it { expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path, host: ENV.fetch("APP_HOST_LEGACY"))) }
|
||||
|
||||
context "when user has preferred domain" do
|
||||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it do
|
||||
expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path, host: ENV.fetch("APP_HOST")))
|
||||
expect(header_value("From", subject)).to include("@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without SafeMailer configured' do
|
||||
|
@ -38,8 +49,10 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
|
||||
subject { described_class.ask_for_merge(user, requested_email) }
|
||||
|
||||
it { expect(subject.to).to eq([requested_email]) }
|
||||
it { expect(subject.body).to include(requested_email) }
|
||||
it 'correctly addresses the email and includes the requested email in the body' do
|
||||
expect(subject.to).to eq([requested_email])
|
||||
expect(subject.body).to include(requested_email)
|
||||
end
|
||||
|
||||
context 'without SafeMailer configured' do
|
||||
it { expect(subject[BalancerDeliveryMethod::FORCE_DELIVERY_METHOD_HEADER]&.value).to eq(nil) }
|
||||
|
@ -59,13 +72,15 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
end
|
||||
|
||||
describe '.france_connect_merge_confirmation' do
|
||||
let(:email) { 'new.exemple.fr' }
|
||||
let(:email) { 'new@exemple.fr' }
|
||||
let(:code) { '123456' }
|
||||
|
||||
subject { described_class.france_connect_merge_confirmation(email, code, 15.minutes.from_now) }
|
||||
|
||||
it { expect(subject.to).to eq([email]) }
|
||||
it { expect(subject.body).to include(france_connect_particulier_mail_merge_with_existing_account_url(email_merge_token: code)) }
|
||||
it 'sends to correct email with merge link' do
|
||||
expect(subject.to).to eq([email])
|
||||
expect(subject.body).to include(france_connect_particulier_mail_merge_with_existing_account_url(email_merge_token: code))
|
||||
end
|
||||
|
||||
context 'without SafeMailer configured' do
|
||||
it { expect(subject[BalancerDeliveryMethod::FORCE_DELIVERY_METHOD_HEADER]&.value).to eq(nil) }
|
||||
|
@ -91,16 +106,20 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
|
||||
context 'instructeur' do
|
||||
let(:role) { create(:instructeur) }
|
||||
it { expect(subject.to).to eq([role.user.email]) }
|
||||
it { expect(subject.body).to have_link('Consulter mes archives', href: instructeur_archives_url(procedure)) }
|
||||
it { expect(subject.body).to have_link("#{procedure.id} − #{procedure.libelle}", href: instructeur_procedure_url(procedure)) }
|
||||
it 'sends email with correct links to instructeur' do
|
||||
expect(subject.to).to eq([role.user.email])
|
||||
expect(subject.body).to have_link('Consulter mes archives', href: instructeur_archives_url(procedure, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
expect(subject.body).to have_link("#{procedure.id} − #{procedure.libelle}", href: instructeur_procedure_url(procedure, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
end
|
||||
|
||||
context 'instructeur' do
|
||||
context 'administrateur' do
|
||||
let(:role) { create(:administrateur) }
|
||||
it { expect(subject.to).to eq([role.user.email]) }
|
||||
it { expect(subject.body).to have_link('Consulter mes archives', href: admin_procedure_archives_url(procedure)) }
|
||||
it { expect(subject.body).to have_link("#{procedure.id} − #{procedure.libelle}", href: admin_procedure_url(procedure)) }
|
||||
it 'sends email with correct links to administrateur' do
|
||||
expect(subject.to).to eq([role.user.email])
|
||||
expect(subject.body).to have_link('Consulter mes archives', href: admin_procedure_archives_url(procedure, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
expect(subject.body).to have_link("#{procedure.id} − #{procedure.libelle}", href: admin_procedure_url(procedure, host: ENV.fetch("APP_HOST_LEGACY")))
|
||||
end
|
||||
end
|
||||
|
||||
context 'when perform_later is called' do
|
||||
|
@ -116,8 +135,10 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
describe '.notify_inactive_close_to_deletion' do
|
||||
subject { described_class.notify_inactive_close_to_deletion(user) }
|
||||
|
||||
it { expect(subject.to).to eq([user.email]) }
|
||||
it { expect(subject.body).to include("Cela fait plus de deux ans que vous ne vous êtes pas connecté à #{APPLICATION_NAME}.") }
|
||||
it 'alerts user of inactivity with correct recipient and message' do
|
||||
expect(subject.to).to eq([user.email])
|
||||
expect(subject.body).to include("Cela fait plus de deux ans que vous ne vous êtes pas connecté à #{APPLICATION_NAME}.")
|
||||
end
|
||||
|
||||
context 'when perform_later is called' do
|
||||
let(:custom_queue) { 'low_priority' }
|
||||
|
@ -133,9 +154,11 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
let(:content) { "Bonjour,\r\nsaut de ligne" }
|
||||
subject { described_class.notify_after_closing(user, content, procedure) }
|
||||
|
||||
it { expect(subject.to).to eq([user.email]) }
|
||||
it { expect(subject.body).to include("Clôture d'une démarche sur Démarches simplifiées") }
|
||||
it { expect(subject.body).to include("Bonjour,\r\n<br />saut de ligne") }
|
||||
it 'notifies user about procedure closing with detailed message' do
|
||||
expect(subject.to).to eq([user.email])
|
||||
expect(subject.body).to include("Clôture d'une démarche sur Démarches simplifiées")
|
||||
expect(subject.body).to include("Bonjour,\r\n<br />saut de ligne")
|
||||
end
|
||||
|
||||
context 'when perform_later is called' do
|
||||
let(:custom_queue) { 'low_priority' }
|
||||
|
|
|
@ -25,7 +25,7 @@ describe MailTemplateConcern do
|
|||
it do
|
||||
expected =
|
||||
"[demarches-simplifiees.fr] #{dossier.id} #{dossier.procedure.libelle} " +
|
||||
"<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}\">http://localhost:3000/dossiers/#{dossier.id}</a>"
|
||||
"<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}\">http://test.host/dossiers/#{dossier.id}</a>"
|
||||
|
||||
is_expected.to eq(expected)
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ describe MailTemplateConcern do
|
|||
|
||||
describe "in closed mail without justificatif" do
|
||||
let(:mail) { create(:closed_mail, procedure: procedure) }
|
||||
it { is_expected.to eq("<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}/attestation\">http://localhost:3000/dossiers/#{dossier.id}/attestation</a>") }
|
||||
it { is_expected.to eq("<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}/attestation\">http://test.host/dossiers/#{dossier.id}/attestation</a>") }
|
||||
it { is_expected.to_not include("Télécharger le justificatif") }
|
||||
end
|
||||
|
||||
|
@ -86,7 +86,7 @@ describe MailTemplateConcern do
|
|||
let(:mail) { create(:closed_mail, procedure: procedure) }
|
||||
|
||||
it { expect(dossier.justificatif_motivation).to be_attached }
|
||||
it { is_expected.to include("<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}/attestation\">http://localhost:3000/dossiers/#{dossier.id}/attestation</a>") }
|
||||
it { is_expected.to include("<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}/attestation\">http://test.host/dossiers/#{dossier.id}/attestation</a>") }
|
||||
it { is_expected.to_not include("Télécharger le justificatif") }
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe ProcedureSerializer do
|
|||
let(:procedure) { create(:procedure, :published) }
|
||||
|
||||
it {
|
||||
is_expected.to include(link: "http://localhost:3000/commencer/#{procedure.path}")
|
||||
is_expected.to include(link: "http://test.host/commencer/#{procedure.path}")
|
||||
is_expected.to include(state: "publiee")
|
||||
}
|
||||
end
|
||||
|
|
5
spec/support/mailer.rb
Normal file
5
spec/support/mailer.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
def header_value(name, message)
|
||||
message.header.fields.find { _1.name == name }.value
|
||||
end
|
|
@ -4,6 +4,8 @@ describe 'instructeur_mailer/send_notifications', type: :view do
|
|||
before do
|
||||
assign(:data, data)
|
||||
|
||||
allow(Current).to receive(:application_name).and_return(APPLICATION_NAME)
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue