Improved reply to / recipient tests (added real name for tests).

This commit is contained in:
Martin Edenhofer 2017-10-09 02:21:07 +02:00
parent 6e227f5b71
commit 0016cb21a5
2 changed files with 18 additions and 3 deletions

View file

@ -950,8 +950,23 @@ class App.Utils
article_created_by_email = undefined article_created_by_email = undefined
if article_created_by && article_created_by.email if article_created_by && article_created_by.email
article_created_by_email = article_created_by.email.toLowerCase() article_created_by_email = article_created_by.email.toLowerCase()
if article.sender.name is 'Agent' && ((article_created_by_email && article.from && !article.from.match(article_created_by_email)) || isLocalAddress(article.from))
# check if article sender is local
if !_.isEmpty(article.from)
senderIsLocal = false
senders = emailAddresses.parseAddressList(article.from)
if senders && senders[0] && senders[0].address
senderIsLocal = isLocalAddress(senders[0].address)
# sender is local
if senderIsLocal
articleNew.to = article.to articleNew.to = article.to
# sender is agent from is different (sender was system)
else if article.sender.name is 'Agent' && article_created_by_email && article.from && !article.from.match(article_created_by_email)
articleNew.to = article.to
# sender was regular customer
else else
if article.reply_to if article.reply_to
articleNew.to = article.reply_to articleNew.to = article.reply_to

View file

@ -2419,8 +2419,8 @@ test('check getRecipientArticle format', function() {
sender: { sender: {
name: 'Agent', name: 'Agent',
}, },
from: 'zammad@example.com', from: 'Sender <zammad@example.com>',
to: 'customer@example.com', to: 'Customer <customer@example.com>',
cc: '', cc: '',
} }
result = { result = {