Fixed issue #519 - Mails get imported as text/html instead of text/plain.

This commit is contained in:
Thorsten Eckel 2016-12-09 13:16:33 +01:00
parent 9b9f9ed8c5
commit 0646b9dc25
2 changed files with 22 additions and 37 deletions

View file

@ -5,21 +5,22 @@ module Import
include Import::OTRS::Helper include Import::OTRS::Helper
MAPPING = { MAPPING = {
TicketID: :ticket_id, TicketID: :ticket_id,
ArticleID: :id, ArticleID: :id,
Body: :body, Body: :body,
From: :from, From: :from,
To: :to, To: :to,
Cc: :cc, Cc: :cc,
Subject: :subject, Subject: :subject,
InReplyTo: :in_reply_to, InReplyTo: :in_reply_to,
MessageID: :message_id, MessageID: :message_id,
#ReplyTo: :reply_to, #ReplyTo: :reply_to,
References: :references, References: :references,
Changed: :updated_at, ContentType: :content_type,
Created: :created_at, Changed: :updated_at,
ChangedBy: :updated_by_id, Created: :created_at,
CreatedBy: :created_by_id, ChangedBy: :updated_by_id,
CreatedBy: :created_by_id,
}.freeze }.freeze
def initialize(article) def initialize(article)

View file

@ -27,9 +27,8 @@ RSpec.describe Import::OTRS::Article do
context 'customer phone' do context 'customer phone' do
let(:object_structure) { load_article_json('customer_phone_attachment') } let(:object_structure) { load_article_json('customer_phone_attachment') }
let(:zammad_structure) {
it 'creates' do {
zammad_structure = {
created_by_id: '3', created_by_id: '3',
updated_by_id: 1, updated_by_id: 1,
ticket_id: '730', ticket_id: '730',
@ -38,6 +37,7 @@ RSpec.describe Import::OTRS::Article do
from: '"Betreuter Kunde" <kunde2@kunde.de>,', from: '"Betreuter Kunde" <kunde2@kunde.de>,',
to: 'Postmaster', to: 'Postmaster',
cc: '', cc: '',
content_type: 'text/plain; charset=utf-8',
subject: 'test #3', subject: 'test #3',
in_reply_to: '', in_reply_to: '',
message_id: '', message_id: '',
@ -48,30 +48,14 @@ RSpec.describe Import::OTRS::Article do
internal: false, internal: false,
sender_id: 2 sender_id: 2
} }
}
it 'creates' do
expect(Import::OTRS::Article::AttachmentFactory).to receive(:import) expect(Import::OTRS::Article::AttachmentFactory).to receive(:import)
creates_with(zammad_structure) creates_with(zammad_structure)
end end
it 'updates' do it 'updates' do
zammad_structure = {
created_by_id: '3',
updated_by_id: 1,
ticket_id: '730',
id: '3970',
body: 'test #3',
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
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) expect(Import::OTRS::Article::AttachmentFactory).to receive(:import)
updates_with(zammad_structure) updates_with(zammad_structure)
end end