Browse Source

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

Rolf Schmidt 4 years ago
parent
commit
aa9d896069
2 changed files with 22 additions and 0 deletions
  1. 2 0
      app/assets/javascripts/app/models/ticket.coffee
  2. 20 0
      spec/system/ticket/zoom_spec.rb

+ 2 - 0
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

+ 20 - 0
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 <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