openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.12k stars 723 forks source link

Producer with "Profile only" package cannot remove himself from an OC (after he granted permissions to be added) #5832

Open filipefurtad0 opened 4 years ago

filipefurtad0 commented 4 years ago

Description

After a Producer with "Profile only" package granted permissions to be added to order cycles, it cannot remove itself from that OC, under /admin/order_cycles. Editing the order cycle page works (there's an endless spinner in there, issue #5831), that is, adding removing products (ticking/un-ticking) but deleting itself from the OC and saving changes does not seem to take effect.

Expected Behavior

The Producer should be able to remove himself from a given OC, by editing the respective order cycles, in the page /admin/order_cycles. After this, the Order Cycles option on the main menu should disappear (right?)

Actual Behaviour

The producer cannot remove himself from the Order Cycle (changes don't seem to take effect).

Steps to Reproduce

  1. Create or use a Producer with "Profile only" package.
  2. As a producer: Add permissions for a given Hub to add this Producer to a given OC.
  3. As a manager of this hub, add the producer to an OC.
  4. As the producer: go to /admin/order_cycles and edit the OC it was added to.
  5. On the "Incoming Products" section click on the trash bin symbol. Click "Save and Next".
  6. On "Outgoing Products" section click on the trash bin as well. See the warning: image.png
  7. Accept, and see redirection to /admin/order_cycles (spinner). Verify you are still on the OC, and that "Order Cycles" still appears on the Dashboard and main menu.

Animated Gif/Screenshot

Peek 2020-07-27 18-39.gif

Workaround

Un-selecting all the producers products from the "Incoming Products" works, and removes them from the shopfront.

Severity

bug-s4: it's annoying, but you can use it

Your Environment

Possible Fix

RachL commented 4 years ago

@filipefurtad0 I don't think anyone can do this except the coordinator isn't? To remove permission, I think the easier is to remove the permission to add to order cycle. That's why I'm not sure this is a bug?

filipefurtad0 commented 4 years ago

Thanks @RachL! Yes, I am not sure either.

Removing the "permission to add to the OC" does not remove you from that OC. It just prevents you from being added again - after the coordinator removes you.

It just did not feel right, to be able to click the trash bin (both in incoming and outgoing products), save changes, and see this does not take effect at all.

I see two scenarios: i) If this is something only the coordinator should be able to do, then the Producer should not see the trash-bin symbols (which give an idea he is able to change something on that respect)

ii) If the Producer has a say here, and should be able to remove himself (he is already able to remove his produce, this works) then the changes should take effect.

What do you think? Would this be something to post on #product-curation?

audez commented 2 years ago

I just tested it and it's the same for "Producer Hub" and "Producer Shop" packages, it's impossible to remove oneself from the OC. Same when the producer removes the permission while the OC is ongoing.

So if it's only the coordinator who can remove suppliers from the OC, I agree that the trash bin shouldn't be displayed. Or maybe a more explicit solution could be: display the trash bin but disable it, and on hover display a message like "Only the coordinator of the order cycle can remove a supplier". What do you think ?