Fixes #2980 - Article Notes added via Macro are not HTML formatted.

This commit is contained in:
Rolf Schmidt 2020-12-07 14:09:37 +01:00 committed by Thorsten Eckel
parent a2e3d8c7b4
commit aa9d896069
2 changed files with 22 additions and 0 deletions

View file

@ -177,6 +177,8 @@ class App.Ticket extends App.Model
content.sender_id = sender.id content.sender_id = sender.id
if !content.from if !content.from
content.from = App.Session.get('login') content.from = App.Session.get('login')
if !content.content_type
params.article.content_type = 'text/html'
# apply direct value changes # apply direct value changes
for articleKey, aricleValue of content for articleKey, aricleValue of content

View file

@ -1265,4 +1265,24 @@ RSpec.describe 'Ticket zoom', type: :system do
end end
end end
end end
describe 'Macros', authenticated_as: :authenticate do
let(:macro) { create :macro, perform: { 'article.note'=>{ 'body' => 'macro <b>body</b>', 'internal' => 'true', 'subject' => 'macro note' } } }
let!(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
def authenticate
macro
true
end
it 'does html macro by default' do
visit "ticket/zoom/#{ticket.id}"
find('.js-openDropdownMacro').click
all('.js-dropdownActionMacro').last.click
await_empty_ajax_queue
expect(ticket.reload.articles.last.body).to eq('macro <b>body</b>')
expect(ticket.reload.articles.last.content_type).to eq('text/html')
end
end
end end