Fixes #3816 - Zammad 5 mail template double signature.
This commit is contained in:
parent
0e60fd5f62
commit
a8aea71a85
2 changed files with 31 additions and 6 deletions
|
@ -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('<br><br>')
|
||||
|
@ -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')
|
|
@ -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.<br><br><div data-signature="true" data-signature-id="1"> Test Other Agent<br><br>--<br> Super Support - Waterford Business Park<br> 5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA<br> Email: hot@example.com - Web: <a href="http://www.example.com/" rel="nofollow noreferrer noopener" target="_blank">http://www.example.com/</a><br>--</div>'
|
||||
)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue