From ee20d354875095aa692f2c76a7ea6f858f9718cf Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 15 Jul 2019 15:38:46 +0100 Subject: [PATCH] Fix authorization issue in shipment actions, authorization was being done on a struct (shipment manifest), now it's done on the shipment itself This is similar to https://github.com/spree/spree/pull/5624 --- .../admin/orders/_shipment_manifest.html.erb | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/views/spree/admin/orders/_shipment_manifest.html.erb b/app/views/spree/admin/orders/_shipment_manifest.html.erb index 2568e9e791..9ae19c7981 100644 --- a/app/views/spree/admin/orders/_shipment_manifest.html.erb +++ b/app/views/spree/admin/orders/_shipment_manifest.html.erb @@ -18,16 +18,14 @@ <% end %> <%= line_item_shipment_price(line_item, item.quantity) %> - <% unless shipment.shipped? %> - - <% if can? :update, item %> - <%= link_to '', '#', :class => 'save-item icon_link icon-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %> - <%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %> - <%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> - <%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %> - <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove', :confirm => Spree.t(:are_you_sure)}, :title => Spree.t('delete') %> - <% end %> - - <% end %> + + <% if !shipment.shipped? && can?(:update, shipment) %> + <%= link_to '', '#', :class => 'save-item icon_link icon-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %> + <%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %> + <%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> + <%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %> + <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove', :confirm => Spree.t(:are_you_sure)}, :title => Spree.t('delete') %> + <% end %> + <% end %>