Skip to content

Commit

Permalink
Fixes #5168 - Ticket history shows html when updating articles.
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Liebe <fl@zammad.com>
  • Loading branch information
rolfschmidt and fliebe92 committed May 14, 2024
1 parent 93f4da1 commit 573cd29
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class App.GenericHistory extends App.ControllerModal
for item in items
if item.object is 'Ticket::Article'
item.object = 'Article'
if item.attribute is 'body'
item.value_from = App.Utils.html2text(item.value_from)
item.value_to = App.Utils.html2text(item.value_to)
if item.object is 'Ticket::SharedDraftZoom'
item.object = 'Draft'

Expand Down
25 changes: 25 additions & 0 deletions spec/system/ticket/zoom/history_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,29 @@ def authenticate
expect(page).to have_text('triggered')
end
end

describe 'Ticket history shows html when updating articles #5168' do
let(:old_body) { SecureRandom.uuid }
let(:new_body) { SecureRandom.uuid }
let(:ticket) { create(:ticket, group: Group.first) }
let(:article) { create(:ticket_article, ticket: ticket, body: "<div><b>#{old_body}</b></div>", content_type: 'text/html') }

def authenticate
article.update(body: "<div><b>#{new_body}</b></div>")
true
end

before do
visit "#ticket/zoom/#{ticket.id}"
end

it 'does not show html in the ticket history', :aggregate_failures do
click '.sidebar-header-headline'
click 'li[data-type=ticket-history]'
expect(page).to have_text(old_body)
expect(page).to have_text(new_body)
expect(page).to have_no_text('<div>')
expect(page).to have_no_text('</div>')
end
end
end

0 comments on commit 573cd29

Please sign in to comment.