Fixes #2551 - Reply-to header ignored if from contains a system address

This commit is contained in:
Mantas 2021-06-18 14:07:14 +03:00
parent f7a17b6be8
commit 2cab5742b2
2 changed files with 47 additions and 1 deletions

View file

@ -1253,7 +1253,7 @@ class App.Utils
# sender is local # sender is local
if senderIsLocal if senderIsLocal
articleNew.to = article.to articleNew.to = article.reply_to || article.to
# sender is agent - sent via system # sender is agent - sent via system
else if article.sender.name is 'Agent' && article_created_by_email && article.from && article.from.toString().toLowerCase().match(article_created_by_email) && !recipientIsLocal else if article.sender.name is 'Agent' && article_created_by_email && article.from && article.from.toString().toLowerCase().match(article_created_by_email) && !recipientIsLocal

View file

@ -3142,6 +3142,52 @@ test('check getRecipientArticle format', function() {
verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type) verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
deepEqual(verify, result) deepEqual(verify, result)
// https://github.com/zammad/zammad/issues/2551
// If "From:" is local address and "Reply-To:" is available, use it
var article_customer = {
login: 'login',
firstname: 'article',
lastname: 'lastname',
email: 'article_customer@example.com',
}
var ticket_customer = {
login: 'login2',
firstname: 'ticket',
lastname: 'lastname',
email: 'ticket_customer@example.com',
}
ticket = {
customer: ticket_customer,
}
article = {
type: {
name: 'email',
},
sender: {
name: 'Customer',
},
from: 'article lastname <article_customer@example.com>',
to: 'some group',
reply_to: 'asd@example.com',
message_id: 'message_id22',
created_by: {
login: 'login',
firstname: 'firstname',
lastname: 'lastname',
email: 'article_created_by@example.com',
},
}
email_addresses = [{ email: 'article_customer@example.com'}]
result = {
to: 'asd@example.com',
cc: '',
body: '',
in_reply_to: 'message_id22',
}
verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type, email_addresses)
deepEqual(verify, result)
}); });
test("contentTypeCleanup", function() { test("contentTypeCleanup", function() {