Followup for issue#719 - ensure that title is set even via email creation.

This commit is contained in:
Martin Edenhofer 2017-02-13 15:05:28 +01:00
parent c1d663e4e4
commit e1059d4ece
2 changed files with 52 additions and 3 deletions

View file

@ -512,9 +512,13 @@ returns
if !group
group = Group.first
end
title = mail[:subject]
if title.blank?
title = '-'
end
ticket = Ticket.new(
group_id: group.id,
title: mail[:subject] || '',
title: title,
preferences: preferences,
)
set_attributes_by_x_headers(ticket, 'ticket', mail)

View file

@ -72,6 +72,51 @@ Some Textäöü",
{
data: "From: me@example.com
To: customer@example.com
Subject:
Some Textäöü without subject#1",
channel: {
trusted: false,
},
success: true,
result: {
0 => {
priority: '2 normal',
title: '-',
},
1 => {
body: 'Some Textäöü without subject#1',
sender: 'Customer',
type: 'email',
internal: false,
},
},
},
{
data: "From: me@example.com
To: customer@example.com
Some Textäöü without subject#2",
channel: {
trusted: false,
},
success: true,
result: {
0 => {
priority: '2 normal',
title: '-',
},
1 => {
body: 'Some Textäöü without subject#2',
sender: 'Customer',
type: 'email',
internal: false,
},
},
},
{
data: "From: me@example.com
To: customer@example.com
Subject: äöü some subject
Some Textäöü".encode('ISO-8859-1'),
@ -79,7 +124,7 @@ Some Textäöü".encode('ISO-8859-1'),
result: {
0 => {
priority: '2 normal',
title: '', # should be äöü some subject, but can not be parsed from mime tools
title: '-', # should be äöü some subject, but can not be parsed from mime tools
},
1 => {
body: 'Some Textäöü',
@ -206,7 +251,7 @@ Some Text",
result: {
0 => {
priority: '2 normal',
title: '',
title: '-',
},
1 => {
from: 'marketingmanager@nthcpghana.com',