openfoodnetwork icon indicating copy to clipboard operation
openfoodnetwork copied to clipboard

When producer enterprises "hide all references" their name gets hidden on product shopfront as well

Open RachL opened this issue 2 years ago • 3 comments

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

image

Actual Behaviour

We see a blank space

image

Steps to Reproduce

  1. Go to a producer profile settings /admin/enterprises/XXX/edit
  2. Select "hide all preferences"
  3. Observe a shopfront with this producer products
  4. 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

RachL avatar Sep 23 '22 10:09 RachL

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,
+      }

jibees avatar Sep 26 '22 12:09 jibees

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

drummer83 avatar Oct 07 '22 17:10 drummer83

It was decided to keep this open in https://github.com/openfoodfoundation/wishlist/issues/284#issuecomment-1272095510

sigmundpetersen avatar Oct 10 '22 09:10 sigmundpetersen