From a0d39cdc2c307fc7e1c89d1d1ca3bd2ae440d474 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 17 Nov 2021 16:01:51 +0100 Subject: [PATCH] Fixes #3844 - No signature on new ticket if email is default message type. --- .../controllers/agent_ticket_create.coffee | 30 ++++++++++++------- spec/system/ticket/create_spec.rb | 16 ++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 8e33ac8e6..720f69913 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -49,7 +49,15 @@ class App.TicketCreate extends App.Controller if @ticket_id && @article_id @split = "/#{@ticket_id}/#{@article_id}" - @buildScreen(params) + @ajax( + type: 'GET' + url: "#{@apiPath}/ticket_create" + processData: true + success: (data, status, xhr) => + App.Collection.loadAssets(data.assets) + @formMeta = data.form_meta + @buildScreen(params) + ) # rerender view, e. g. on langauge change @controllerBind('ui:rerender', => @@ -272,6 +280,7 @@ class App.TicketCreate extends App.Controller localeRender = => @render(template) App.QueueManager.add(@queueKey, localeRender) + return if !@formMeta App.QueueManager.run(@queueKey) updateTaskManagerAttachments: (attribute, attachments) => @@ -326,15 +335,16 @@ class App.TicketCreate extends App.Controller handlers = @Config.get('TicketCreateFormHandler') @controllerFormCreateMiddle = new App.ControllerForm( - el: @$('.ticket-form-middle') - form_id: @formId - model: App.Ticket - screen: 'create_middle' - handlersConfig: handlers - params: params - noFieldset: true - taskKey: @taskKey - rejectNonExistentValues: true + el: @$('.ticket-form-middle') + form_id: @formId + model: App.Ticket + screen: 'create_middle' + handlersConfig: handlers + formMeta: @formMeta + params: params + noFieldset: true + taskKey: @taskKey + rejectNonExistentValues: true ) # tunnel events to make sure core workflow does know diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index 2fdb27c22..7a7701517 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -862,4 +862,20 @@ RSpec.describe 'Ticket Create', type: :system do find '.token', text: input # wait for email to tokenize end end + + describe 'No signature on new ticket if email is default message type #3844', authenticated_as: :authenticate do + def authenticate + Setting.set('ui_ticket_create_default_type', 'email-out') + Group.where.not(name: 'Users').each { |g| g.update(active: false) } + true + end + + before do + visit 'ticket/create' + end + + it 'does render the create screen with an initial core workflow state to set signatures and other defaults properly' do + expect(page.find('.richtext-content')).to have_text('Support') + end + end end