openfoodnetwork
openfoodnetwork copied to clipboard
When producer enterprises "hide all references" their name gets hidden on product shopfront as well
Description
"hide all references" is made in order to hide link to enterprises which do not want to appear outside of their community. This should not include their products. Each products should always show the link to the producer profile.
Expected Behavior
See producer 's name
Actual Behaviour
We see a blank space
Steps to Reproduce
- Go to a producer profile settings
/admin/enterprises/XXX/edit
- Select "hide all preferences"
- Observe a shopfront with this producer products
- See producer name is blank
Workaround
Unhide.
Severity
bug-s3: a feature is broken but there is a workaround
Your Environment
- Version used: v4.2.14
- Browser name and version: ALL
- Operating System and version (desktop or mobile): all
Possible fix
diff --git a/app/assets/javascripts/darkswarm/services/shopfront.js.coffee b/app/assets/javascripts/darkswarm/services/shopfront.js.coffee
index 2dd0837946..3d801e40c7 100644
--- a/app/assets/javascripts/darkswarm/services/shopfront.js.coffee
+++ b/app/assets/javascripts/darkswarm/services/shopfront.js.coffee
@@ -6,3 +6,10 @@ angular.module('Darkswarm').factory 'Shopfront', (shopfront) ->
constructor: ->
for producer in shopfront.producers
@producers_by_id[producer.id] = producer
+ # Add the current to the list of producers
+ @producers_by_id[shopfront.id] = {
+ name: shopfront.name,
+ id: shopfront.id,
+ address: shopfront.address,
+ path: shopfront.path,
+ }
Ouch, this needs to be decided, see #284. I don't have a strong opinion, but one of these two needs to be closed. @openfoodfoundation/train-drivers-product-owners
It was decided to keep this open in https://github.com/openfoodfoundation/wishlist/issues/284#issuecomment-1272095510