Skip to content

Commit

Permalink
amelioration(mailer.logo): utilise procedure_logo_url pour afficher l…
Browse files Browse the repository at this point in the history
…e logo dans les mails
  • Loading branch information
Martin committed Aug 14, 2023
1 parent 88552a1 commit eb84b02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
8 changes: 4 additions & 4 deletions app/mailers/dossier_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def notify_new_draft
@dossier = params[:dossier]
I18n.with_locale(@dossier.user_locale) do
@service = @dossier.procedure.service
@logo_url = @dossier.procedure.email_logo_url
@logo_url = procedure_logo_url(@dossier.procedure)
@subject = default_i18n_subject(libelle_demarche: @dossier.procedure.libelle)

mail(to: @dossier.user_email_for(:notification), subject: @subject) do |format|
Expand All @@ -27,7 +27,7 @@ def notify_new_answer
I18n.with_locale(dossier.user_locale) do
@dossier = dossier
@service = dossier.procedure.service
@logo_url = @dossier.procedure.email_logo_url
@logo_url = procedure_logo_url(@dossier.procedure)
@body = commentaire.body
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)

Expand All @@ -52,7 +52,7 @@ def notify_pending_correction
I18n.with_locale(dossier.user_locale) do
@dossier = dossier
@service = dossier.procedure.service
@logo_url = @dossier.procedure.email_logo_url
@logo_url = procedure_logo_url(@dossier.procedure)
@correction = commentaire.dossier_correction

@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
Expand Down Expand Up @@ -85,7 +85,7 @@ def notify_revert_to_instruction(dossier)
I18n.with_locale(dossier.user_locale) do
@dossier = dossier
@service = dossier.procedure.service
@logo_url = @dossier.procedure.email_logo_url
@logo_url = procedure_logo_url(@dossier.procedure)
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)

mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class NotificationMailer < ApplicationMailer

def send_notification
@service = @dossier.procedure.service
@logo_url = @dossier.procedure.email_logo_url
@logo_url = procedure_logo_url(@dossier.procedure)
attachments[@attachment[:filename]] = @attachment[:content] if @attachment.present?
I18n.with_locale(@dossier.user_locale) do
mail(subject: @subject, to: @email, template_name: 'send_notification')
Expand Down
8 changes: 0 additions & 8 deletions app/models/procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,14 +635,6 @@ def missing_steps
result
end

def email_logo_url
if logo.attached?
logo.variant(:email).processed.blob.url(expires_in: 1.year)
else
ActionController::Base.helpers.image_url(PROCEDURE_DEFAULT_LOGO_SRC)
end
end

def logo_url
if logo.attached?
Rails.application.routes.url_helpers.url_for(logo)
Expand Down

0 comments on commit eb84b02

Please sign in to comment.