Skip to content

Commit

Permalink
Do not display OFN banner on order confirmation email if white label
Browse files Browse the repository at this point in the history
  • Loading branch information
jibees committed May 17, 2023
1 parent dfafbfe commit 2336981
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/mailers/spree/order_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def cancel_email_for_shop(order)

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,
Expand Down
14 changes: 14 additions & 0 deletions spec/mailers/order_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@
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
Expand Down

0 comments on commit 2336981

Please sign in to comment.