mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
We want to trigger the backordering for any linked product now. So let's do that check early and then select the variants in the background. It means less data passed to the job and less space for race conditions.
25 lines
551 B
Ruby
25 lines
551 B
Ruby
# frozen_string_literal: true
|
|
|
|
class BackorderMailer < ApplicationMailer
|
|
include I18nHelper
|
|
|
|
def backorder_failed(order)
|
|
@order = order
|
|
@linked_variants = order.variants
|
|
|
|
I18n.with_locale valid_locale(order.distributor.owner) do
|
|
mail(to: order.distributor.owner.email)
|
|
end
|
|
end
|
|
|
|
def backorder_incomplete(user, distributor, order_cycle, order_id)
|
|
@distributor = distributor
|
|
@order_cycle = order_cycle
|
|
@order_id = order_id
|
|
|
|
I18n.with_locale valid_locale(user) do
|
|
mail(to: user.email)
|
|
end
|
|
end
|
|
end
|