mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Update app/reflexes/products_reflex.rb
Co-authored-by: David Cook <david@redcliffs.net>
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
b42dfb574b
commit
3245f7ff99
@@ -70,11 +70,9 @@ class ProductsReflex < ApplicationReflex
|
||||
end
|
||||
|
||||
def producers
|
||||
producers = if current_user.has_spree_role?("admin")
|
||||
Enterprise.all
|
||||
else
|
||||
current_user.enterprises
|
||||
end
|
||||
producers = [{ label: "All", value: "all" }] +
|
||||
OpenFoodNetwork::Permissions.new(@user)
|
||||
.managed_product_enterprises.is_primary_producer.by_name
|
||||
producers.map { |p| [p.name, p.id] }
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user