mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-21 00:47:26 +00:00
Show message about resumable orders when unpausing a subscription
This commit is contained in:
@@ -7,6 +7,7 @@ module Admin
|
||||
before_filter :strip_banned_attrs, only: [:update]
|
||||
before_filter :wrap_nested_attrs, only: [:create, :update]
|
||||
before_filter :check_for_open_orders, only: [:cancel, :pause]
|
||||
before_filter :check_for_canceled_orders, only: [:unpause]
|
||||
respond_to :json
|
||||
|
||||
def index
|
||||
@@ -125,6 +126,12 @@ module Admin
|
||||
render json: { errors: { open_orders: t('admin.subscriptions.confirm_cancel_open_orders_msg') } }, status: :conflict
|
||||
end
|
||||
|
||||
def check_for_canceled_orders
|
||||
return if params[:canceled_orders] == 'notified'
|
||||
return if @subscription.proxy_orders.active.canceled.empty?
|
||||
render json: { errors: { canceled_orders: t('admin.subscriptions.resume_canceled_orders_msg') } }, status: :conflict
|
||||
end
|
||||
|
||||
def strip_banned_attrs
|
||||
params[:subscription].delete :schedule_id
|
||||
params[:subscription].delete :customer_id
|
||||
|
||||
Reference in New Issue
Block a user