From 0646b9dc25422342dcde1b00c99da528d9a81cd4 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 9 Dec 2016 13:16:33 +0100 Subject: [PATCH] Fixed issue #519 - Mails get imported as text/html instead of text/plain. --- lib/import/otrs/article.rb | 31 ++++++++++++++++--------------- spec/import/otrs/article_spec.rb | 28 ++++++---------------------- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/lib/import/otrs/article.rb b/lib/import/otrs/article.rb index bef778d82..6e3fe422e 100644 --- a/lib/import/otrs/article.rb +++ b/lib/import/otrs/article.rb @@ -5,21 +5,22 @@ module Import include Import::OTRS::Helper MAPPING = { - TicketID: :ticket_id, - ArticleID: :id, - Body: :body, - From: :from, - To: :to, - Cc: :cc, - Subject: :subject, - InReplyTo: :in_reply_to, - MessageID: :message_id, - #ReplyTo: :reply_to, - References: :references, - Changed: :updated_at, - Created: :created_at, - ChangedBy: :updated_by_id, - CreatedBy: :created_by_id, + TicketID: :ticket_id, + ArticleID: :id, + Body: :body, + From: :from, + To: :to, + Cc: :cc, + Subject: :subject, + InReplyTo: :in_reply_to, + MessageID: :message_id, + #ReplyTo: :reply_to, + References: :references, + ContentType: :content_type, + Changed: :updated_at, + Created: :created_at, + ChangedBy: :updated_by_id, + CreatedBy: :created_by_id, }.freeze def initialize(article) diff --git a/spec/import/otrs/article_spec.rb b/spec/import/otrs/article_spec.rb index 2fa9cb39e..456fd0c14 100644 --- a/spec/import/otrs/article_spec.rb +++ b/spec/import/otrs/article_spec.rb @@ -27,9 +27,8 @@ RSpec.describe Import::OTRS::Article do context 'customer phone' do let(:object_structure) { load_article_json('customer_phone_attachment') } - - it 'creates' do - zammad_structure = { + let(:zammad_structure) { + { created_by_id: '3', updated_by_id: 1, ticket_id: '730', @@ -38,6 +37,7 @@ RSpec.describe Import::OTRS::Article do from: '"Betreuter Kunde" ,', to: 'Postmaster', cc: '', + content_type: 'text/plain; charset=utf-8', subject: 'test #3', in_reply_to: '', message_id: '', @@ -48,30 +48,14 @@ RSpec.describe Import::OTRS::Article do internal: false, sender_id: 2 } + } + + it 'creates' do expect(Import::OTRS::Article::AttachmentFactory).to receive(:import) creates_with(zammad_structure) end it 'updates' do - zammad_structure = { - created_by_id: '3', - updated_by_id: 1, - ticket_id: '730', - id: '3970', - body: 'test #3', - from: '"Betreuter Kunde" ,', - to: 'Postmaster', - cc: '', - subject: 'test #3', - in_reply_to: '', - message_id: '', - references: '', - updated_at: '2014-11-21 00:21:08', - created_at: '2014-11-21 00:17:41', - type_id: 5, - internal: false, - sender_id: 2 - } expect(Import::OTRS::Article::AttachmentFactory).to receive(:import) updates_with(zammad_structure) end