Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow producer to edit their products on hubs' orders #13113

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/spree/admin/orders_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def distributor_allows_order_editing?(order)
spree_current_user.can_manage_line_items_in_orders_only?
end

def display_value_for_producer(order, value)
return value unless distributor_allows_order_editing?(order)
Copy link
Member

@dacook dacook Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the question here is not if distributor_allows_order_editing?, but if "user is distributor?"

If the current user is not an authorised manager of the distributor, then they should not have access to customer details until permitted. It should be easy to check that I think.

In this case, it works, but could be confusing and if the logic changes in the future it might cause a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's addressed here: 8c73f36


order.distributor&.show_customer_names_to_suppliers ? value : t("admin.reports.hidden")
end
end
end
end
7 changes: 4 additions & 3 deletions app/views/spree/admin/orders/_table_row.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
%span.state{ class: order.shipment_state.to_s}
= t('js.admin.orders.shipment_states.' + order.shipment_state.to_s)
%td
%a{ href: "mailto:#{order.email}", target: "_blank" }
= order.email
- email_value = display_value_for_producer(order, order.email)
%a{ href: "mailto:#{email_value}", target: "_blank" }
= email_value
%td
= order&.bill_address&.full_name_for_sorting
= display_value_for_producer(order, order.bill_address&.full_name_for_sorting)
%td.align-left
%span
= order.display_total
Expand Down