diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index d9231b347..aa254c6e3 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -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', => diff --git a/app/assets/javascripts/app/views/customer_not_ticket_exists.jst.eco b/app/assets/javascripts/app/views/customer_not_ticket_exists.jst.eco index dfd72889b..17aa5bfbe 100644 --- a/app/assets/javascripts/app/views/customer_not_ticket_exists.jst.eco +++ b/app/assets/javascripts/app/views/customer_not_ticket_exists.jst.eco @@ -6,11 +6,15 @@ <% if @has_any_tickets: %>

<%- @T('You have no tickets to display in this overview.') %>

<% else: %> -

<%- @T('You have not created a ticket yet.') %>

-

<%- @T('The way to communicate with us is this thing called "ticket".') %>

-

<%- @T('Please click the button below to create your first one.') %>

+ <% if @is_allowed_to_create_ticket: %> +

<%- @T('You have not created a ticket yet.') %>

+

<%- @T('The way to communicate with us is this thing called "ticket".') %>

+

<%- @T('Please click the button below to create your first one.') %>

-

<%- @T('Create your first ticket') %>

+

<%- @T('Create your first ticket') %>

+ <% else: %> +

<%- @T('You currently don\'t have any tickets.') %>

+ <% end %> <% end %> diff --git a/spec/system/overview_spec.rb b/spec/system/overview_spec.rb index f984e1626..50402cfe8 100644 --- a/spec/system/overview_spec.rb +++ b/spec/system/overview_spec.rb @@ -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)