diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index c39311ce2..75088b62e 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -177,6 +177,8 @@ class App.Ticket extends App.Model content.sender_id = sender.id if !content.from content.from = App.Session.get('login') + if !content.content_type + params.article.content_type = 'text/html' # apply direct value changes for articleKey, aricleValue of content diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index ae7c297a3..04d36d0c0 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -1265,4 +1265,24 @@ RSpec.describe 'Ticket zoom', type: :system do end end end + + describe 'Macros', authenticated_as: :authenticate do + let(:macro) { create :macro, perform: { 'article.note'=>{ 'body' => 'macro body', '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 body') + expect(ticket.reload.articles.last.content_type).to eq('text/html') + end + end end