diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create/form_hander_signature.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create/form_handler_signature.coffee similarity index 77% rename from app/assets/javascripts/app/controllers/agent_ticket_create/form_hander_signature.coffee rename to app/assets/javascripts/app/controllers/agent_ticket_create/form_handler_signature.coffee index f5c2ad89e..25da0b346 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create/form_hander_signature.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create/form_handler_signature.coffee @@ -1,4 +1,4 @@ -class TicketCreateFormHanderSignature +class TicketCreateFormHandlerSignature @run: (params, attribute, attributes, classname, form, ui) -> return if !attribute @@ -19,10 +19,7 @@ class TicketCreateFormHanderSignature if App.Utils.signatureCheck(currentBody.html() || '', signatureFinished) # if signature has changed, in case remove old signature - signature_id = ui.el.closest('.content').find('[data-signature=true]').data('signature-id') - if signature_id && signature_id.toString() isnt signature.id.toString() - - ui.el.closest('.content').find('[data-signature="true"]').remove() + ui.el.closest('.content').find('[data-signature="true"]').remove() if !App.Utils.htmlLastLineEmpty(currentBody) currentBody.append('

') @@ -35,4 +32,4 @@ class TicketCreateFormHanderSignature else ui.el.closest('.content').find('[data-name="body"]').find('[data-signature=true]').remove() -App.Config.set('200-ticketFormSignature', TicketCreateFormHanderSignature, 'TicketCreateFormHandler') +App.Config.set('200-ticketFormSignature', TicketCreateFormHandlerSignature, 'TicketCreateFormHandler') diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index fe01e7ce0..30c94dcd8 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -829,4 +829,32 @@ RSpec.describe 'Ticket Create', type: :system do expect(page.find('.richtext-content')).to have_text('Support') end end + + describe 'Zammad 5 mail template double signature #3816', authenticated_as: :authenticate do + let(:agent_template) { create(:agent) } + let!(:template) do + create( + :template, + :dummy_data, + group: Group.first, owner: agent_template, + body: 'Content dummy.

Test Other Agent

--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--
' + ) + end + + def authenticate + Group.first.update(signature: Signature.first) + true + end + + before do + visit 'ticket/create' + find('[data-type=email-out]').click + end + + it 'does not show double signature on template usage' do + select Group.first.name, from: 'group_id' + use_template(template) + expect(page).to have_no_text('Test Other Agent') + end + end end