From 468b5bf12e0e9bff58652004c645ecb6ad1bc184 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 6 Jul 2018 14:30:12 +0200 Subject: [PATCH] Fixed issue #2118 - A ticket created by customer via web with state new is set to open on second update by customer. --- .../app/controllers/ticket_zoom.coffee | 5 +++++ test/browser/customer_ticket_create_test.rb | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index ccd5c1e0a..4901f2ecc 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -633,6 +633,11 @@ class App.TicketZoom extends App.Controller # and the default is was not set before return if @isDefaultFollowUpStateSet + # and only if ticket is not in "new" state + if @ticket && @ticket.state_id + state = App.TicketState.findByAttribute('id', @ticket.state_id) + return if state && state.default_create is true + # prevent multiple changes for the default follow up state @isDefaultFollowUpStateSet = true diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index 784cb0341..a9108aaa6 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -2,7 +2,7 @@ require 'browser_test_helper' class CustomerTicketCreateTest < TestCase - def test_customer_ticket_create + def test_customer_ticket_create_and_verify_state_after_update @browser = browser_instance login( username: 'nicole.braun@zammad.org', @@ -47,6 +47,12 @@ class CustomerTicketCreateTest < TestCase no_quote: true, ) + # verify if the state has changed to open + match( + css: '.content.active .sidebar [name="state_id"]', + value: 'new', + ) + # update ticket set( css: '.content.active [data-name="body"]', @@ -65,6 +71,12 @@ class CustomerTicketCreateTest < TestCase value: 'some body 1234 äöüß', ) + # check if the ticket state is new after update by customer + match( + css: '.content.active .sidebar [name="state_id"]', + value: 'new', + ) + # now we want to verify the default followup state # for this case we close the ticket first and then # write a new article. If the content is written @@ -153,7 +165,7 @@ class CustomerTicketCreateTest < TestCase ) end - def test_customer_ticket_create_relogin_with_agent_ticket_crearte + def test_customer_ticket_create_relogin_with_agent_ticket_create @browser = browser_instance login( username: 'nicole.braun@zammad.org',