diff --git a/app/views/spree/admin/orders/_table_row.html.haml b/app/views/spree/admin/orders/_table_row.html.haml index 405efb6857..6705719168 100644 --- a/app/views/spree/admin/orders/_table_row.html.haml +++ b/app/views/spree/admin/orders/_table_row.html.haml @@ -47,7 +47,7 @@ - if local_assigns[:success] %i.success.icon-ok-sign{"data-controller": "ephemeral"} = render AdminTooltipComponent.new(text: t('spree.admin.orders.index.edit'), link_text: "", link: edit_admin_order_path(order), link_class: "icon_link with-tip icon-edit no-text") - - if order.ready_to_ship? + - if spree_current_user.can_manage_orders? && order.ready_to_ship? %form = render ShipOrderComponent.new(order: order) = render partial: 'admin/shared/tooltip_button', locals: {button_class: "icon-road icon_link with-tip no-text", reflex_data_id: order.id.to_s, tooltip_text: t('spree.admin.orders.index.ship'), shipment: true} diff --git a/spec/system/admin/orders/producer_actions_spec.rb b/spec/system/admin/orders/producer_actions_spec.rb index f62067086b..26c2c63ad5 100644 --- a/spec/system/admin/orders/producer_actions_spec.rb +++ b/spec/system/admin/orders/producer_actions_spec.rb @@ -83,6 +83,12 @@ RSpec.describe 'As a producer who have the ability to update orders' do expect(page).to have_selector('tr', count: 1) # Only one order expect(page).to have_selector('td', text: name, count: 1) expect(page).to have_selector('td', text: email, count: 1) + within 'td.actions' do + # to have edit button + expect(page).to have_selector("a.icon-edit") + # not to have ship button + expect(page).not_to have_selector('button.icon-road') + end end end end