Skip to content

Commit

Permalink
correctif(dolist): utilise des liens vers les logos des procedures pl…
Browse files Browse the repository at this point in the history
…utôt que des attachements.inlined
  • Loading branch information
Martin committed Jul 27, 2023
1 parent 9571981 commit 425e8e4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ gem 'lograge'
gem 'logstash-event'
gem 'mailjet', require: false
gem 'matrix' # needed by prawn and not default in ruby 3.1
gem 'mini_magick'
gem 'net-imap', require: false # See https://github.com/mikel/mail/pull/1439
gem 'net-pop', require: false # same
gem 'net-smtp', require: false # same
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ DEPENDENCIES
matrix
memory_profiler
mina
mini_magick
net-imap
net-pop
net-smtp
Expand Down
9 changes: 5 additions & 4 deletions app/mailers/dossier_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ class DossierMailer < ApplicationMailer
default from: NO_REPLY_EMAIL
after_action :prevent_perform_deliveries, only: [:notify_new_draft, :notify_new_answer, :notify_pending_correction]


def notify_new_draft
@dossier = params[:dossier]
I18n.with_locale(@dossier.user_locale) do
@service = @dossier.procedure.service
@logo_url = attach_logo(@dossier.procedure)
@logo_url = @dossier.procedure.logo_url
@subject = default_i18n_subject(libelle_demarche: @dossier.procedure.libelle)

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

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

@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
Expand Down Expand Up @@ -85,7 +86,7 @@ def notify_revert_to_instruction(dossier)
I18n.with_locale(dossier.user_locale) do
@dossier = dossier
@service = dossier.procedure.service
@logo_url = attach_logo(dossier.procedure)
@logo_url = @dossier.procedure.logo_url
@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/models/procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ def missing_steps

def logo_url
if logo.attached?
Rails.application.routes.url_helpers.url_for(logo)
Rails.application.routes.url_helpers.url_for(logo.variant(resize_to_limit: [150, 150]).processed)
else
ActionController::Base.helpers.image_url(PROCEDURE_DEFAULT_LOGO_SRC)
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/new_framework_defaults_7_0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# generate variants to use image processing macros and ruby-vips
# operations. See the upgrading guide for detail on the changes required.
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
Rails.application.config.active_storage.variant_processor = :vips
Rails.application.config.active_storage.variant_processor = :mini_magick

# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
Expand Down

0 comments on commit 425e8e4

Please sign in to comment.