Skip to content

hide link to create new invoice if member doesn't have permission (64080) #252

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/views/invoices/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

%br/

- unless @order.status.closed?
- unless @order.status.closed? || !can?(:create_invoices, @order)
%p= render 'actions_index'
10 changes: 10 additions & 0 deletions test/integration/list_invoices_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ class ListInvoicesTest < ActionDispatch::IntegrationTest
end
end

test 'list invoices as employee which is order responsible for another order has no create/edit/destroy links' do
timeout_safe do
list_invoices_as :lucien

assert has_no_link?('Erstellen')
assert has_no_link?('Bearbeiten')
assert has_no_link?('Löschen')
end
end

test 'list invoices as order responsible member has create/edit/destroy links' do
timeout_safe do
list_invoices_as :long_time_john
Expand Down