Fixes #2780 - Shared Organisation issue create your first ticket

This commit is contained in:
Romit Choudhary 2021-09-30 09:25:13 +02:00 committed by Thorsten Eckel
parent 6efafd37ae
commit c72006216e
3 changed files with 22 additions and 5 deletions

View file

@ -1314,7 +1314,7 @@ class Table extends App.Controller
return if ticketListShow[0] || @permissionCheck('ticket.agent')
tickets_count = user.lifetimeCustomerTicketsCount()
@html App.view('customer_not_ticket_exists')(has_any_tickets: tickets_count > 0)
@html App.view('customer_not_ticket_exists')(has_any_tickets: tickets_count > 0, is_allowed_to_create_ticket: @Config.get('customer_ticket_create'))
if tickets_count == 0
@listenTo user, 'refresh', =>

View file

@ -6,11 +6,15 @@
<% if @has_any_tickets: %>
<p><%- @T('You have no tickets to display in this overview.') %></p>
<% else: %>
<% if @is_allowed_to_create_ticket: %>
<p><%- @T('You have not created a ticket yet.') %></p>
<p><%- @T('The way to communicate with us is this thing called "ticket".') %></p>
<p><%- @T('Please click the button below to create your first one.') %></p>
<p><a class="btn btn--primary" href="#customer_ticket_new"><%- @T('Create your first ticket') %></a></p>
<% else: %>
<p><%- @T('You currently don\'t have any tickets.') %></p>
<% end %>
<% end %>
</div>
</div>

View file

@ -23,6 +23,19 @@ RSpec.describe 'Overview', type: :system do
end
end
def authenticate
Setting.set('customer_ticket_create', false)
customer
end
it 'does not show create button when ticket creation via web is disabled', authenticated_as: :authenticate do
visit "ticket/view/#{main_overview.link}"
within :active_content do
expect(page).to have_text 'You currently don\'t have any tickets.'
end
end
it 'shows overview-specific message if customer has tickets in other overview', performs_jobs: true do
perform_enqueued_jobs only: TicketUserTicketCounterJob do
create(:ticket, customer: customer)