mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Ensure shops display as closed when not configured for sales
squashme squashme squash squash squash
This commit is contained in:
committed by
Maikel Linke
parent
4fe5e60967
commit
1f2c6f2a85
@@ -26,6 +26,8 @@ class BaseController < ApplicationController
|
||||
@order_cycles = OrderCycle.with_distributor(@distributor).active
|
||||
.order(@distributor.preferred_shopfront_order_cycle_order)
|
||||
|
||||
ensure_shop_ready
|
||||
|
||||
applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor, "FilterOrderCycles", current_customer.andand.tag_list)
|
||||
applicator.filter!(@order_cycles)
|
||||
|
||||
@@ -34,4 +36,9 @@ class BaseController < ApplicationController
|
||||
current_order(true).set_order_cycle! @order_cycles.first
|
||||
end
|
||||
end
|
||||
|
||||
def ensure_shop_ready
|
||||
# Don't display order cycles if shop is not ready for checkout
|
||||
@order_cycles = {} unless @distributor.ready_for_checkout?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ShopController do
|
||||
let(:distributor) { create(:distributor_enterprise) }
|
||||
let!(:pm) { create(:payment_method) }
|
||||
let!(:sm) { create(:shipping_method) }
|
||||
let(:distributor) { create(:distributor_enterprise, payment_methods: [pm], shipping_methods: [sm]) }
|
||||
|
||||
it "redirects to the home page if no distributor is selected" do
|
||||
spree_get :show
|
||||
|
||||
Reference in New Issue
Block a user