mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Filtering the list of variants visible within each exchange based on permissions
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
angular.module("admin.order_cycles").filter "visibleProducts", ($filter) ->
|
||||
return (products, exchange, rules) ->
|
||||
return (product for product in products when $filter('visibleVariants')(product, exchange, rules).length > 0)
|
||||
@@ -0,0 +1,4 @@
|
||||
angular.module("admin.order_cycles").filter "visibleVariants", ->
|
||||
return (product, exchange, rules) ->
|
||||
enterprise_id = if exchange.incoming then exchange.sender_id else exchange.receiver_id
|
||||
return (variant for variant in product.variants when variant.id in rules[exchange.enterprise_id])
|
||||
Reference in New Issue
Block a user