From 2336981ca09d7893fca8ac87822f5c24123e90ac Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Wed, 17 May 2023 11:28:33 +0200 Subject: [PATCH] Do not display OFN banner on order confirmation email if white label --- app/mailers/spree/order_mailer.rb | 1 + spec/mailers/order_mailer_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/mailers/spree/order_mailer.rb b/app/mailers/spree/order_mailer.rb index 57f8766098..a2fda5d94f 100644 --- a/app/mailers/spree/order_mailer.rb +++ b/app/mailers/spree/order_mailer.rb @@ -28,6 +28,7 @@ module Spree def confirm_email_for_customer(order_or_order_id, resend = false) @order = find_order(order_or_order_id) + @hide_ofn_navigation = @order.distributor.hide_ofn_navigation I18n.with_locale valid_locale(@order.user) do subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend) mail(to: @order.email, diff --git a/spec/mailers/order_mailer_spec.rb b/spec/mailers/order_mailer_spec.rb index 5a20e0fd2e..af305532a2 100644 --- a/spec/mailers/order_mailer_spec.rb +++ b/spec/mailers/order_mailer_spec.rb @@ -44,6 +44,20 @@ describe Spree::OrderMailer do described_class.confirm_email_for_customer(order.id).deliver_now }.to_not raise_error end + + it "display the OFN header by default" do + expect(email.body).to include(ContentConfig.url_for(:footer_logo)) + end + + context 'when hide OFN navigation is enabled for the distributor of the order' do + before do + allow(order.distributor).to receive(:hide_ofn_navigation).and_return(true) + end + + it 'does not display the OFN navigation' do + expect(email.body).to_not include(ContentConfig.url_for(:footer_logo)) + end + end end describe '#confirm_email_for_shop' do