Fixed issue #1303 - ReplyAll - moves recipients from "To" to "CC".
This commit is contained in:
parent
ff9def59a0
commit
6afd9f99b5
2 changed files with 132 additions and 16 deletions
|
@ -941,7 +941,7 @@ class App.Utils
|
|||
article_created_by_email = undefined
|
||||
if article_created_by && article_created_by.email
|
||||
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) # (!article.from.match(article_created_by_email) || !EmailAddress(XXXXX) )
|
||||
if article.sender.name is 'Agent' && article_created_by_email && article.from && !article.from.match(article_created_by_email)
|
||||
articleNew.to = article.to
|
||||
else
|
||||
if article.reply_to
|
||||
|
@ -968,11 +968,6 @@ class App.Utils
|
|||
|
||||
addAddresses = (addressLine, line) ->
|
||||
lineNew = ''
|
||||
if !_.isEmpty(line)
|
||||
if !_.isEmpty(addressLine)
|
||||
addressLine += ', '
|
||||
addressLine += line
|
||||
|
||||
recipients = emailAddresses.parseAddressList(addressLine)
|
||||
if !_.isEmpty(recipients)
|
||||
for recipient in recipients
|
||||
|
@ -992,16 +987,21 @@ class App.Utils
|
|||
lineNew = lineNew + localRecipientAddress
|
||||
|
||||
lineNew
|
||||
if !_.isEmpty(line)
|
||||
if !_.isEmpty(lineNew)
|
||||
lineNew += ', '
|
||||
lineNew += line
|
||||
lineNew
|
||||
|
||||
if articleNew.to
|
||||
articleNew.to = addAddresses(articleNew.to)
|
||||
|
||||
if all
|
||||
if article.from
|
||||
articleNew.cc = addAddresses(articleNew.cc, article.from)
|
||||
articleNew.to = addAddresses(article.from, articleNew.to)
|
||||
if article.to
|
||||
articleNew.cc = addAddresses(articleNew.cc, article.to)
|
||||
articleNew.to = addAddresses(article.to, articleNew.to)
|
||||
if article.cc
|
||||
articleNew.cc = addAddresses(articleNew.cc, article.cc)
|
||||
articleNew.cc = addAddresses(article.cc, articleNew.cc)
|
||||
|
||||
articleNew
|
||||
|
|
|
@ -2022,7 +2022,6 @@ test('check getRecipientArticle format', function() {
|
|||
},
|
||||
from: 'agent@example.com',
|
||||
to: 'customer@example.com',
|
||||
// cc: 'zammad@example.com',
|
||||
}
|
||||
result = {
|
||||
to: 'agent@example.com',
|
||||
|
@ -2234,12 +2233,6 @@ test('check getRecipientArticle format', function() {
|
|||
verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
|
||||
deepEqual(verify, result)
|
||||
|
||||
customer = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
email: 'customer@example.com',
|
||||
}
|
||||
customer = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
|
@ -2279,6 +2272,129 @@ test('check getRecipientArticle format', function() {
|
|||
verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
|
||||
deepEqual(verify, result)
|
||||
|
||||
customer = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
email: 'customer@example.com',
|
||||
}
|
||||
ticket = {
|
||||
customer: customer,
|
||||
}
|
||||
article = {
|
||||
message_id: 'message_id15',
|
||||
created_by: customer,
|
||||
type: {
|
||||
name: 'email',
|
||||
},
|
||||
sender: {
|
||||
name: 'Agent',
|
||||
},
|
||||
from: 'customer@example.com',
|
||||
to: 'customer1@example.com, customer2@example.com, zammad@example.com',
|
||||
cc: '',
|
||||
}
|
||||
result = {
|
||||
to: 'customer@example.com, customer1@example.com, customer2@example.com',
|
||||
cc: '',
|
||||
body: '',
|
||||
in_reply_to: 'message_id15',
|
||||
}
|
||||
email_addresses = [
|
||||
{
|
||||
email: 'zammad@example.com',
|
||||
},
|
||||
{
|
||||
email: 'zammad2@example.com',
|
||||
}
|
||||
]
|
||||
verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
|
||||
deepEqual(verify, result)
|
||||
|
||||
customer = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
email: 'customer@example.com',
|
||||
}
|
||||
ticket = {
|
||||
customer: customer,
|
||||
}
|
||||
article = {
|
||||
message_id: 'message_id15',
|
||||
created_by: customer,
|
||||
type: {
|
||||
name: 'email',
|
||||
},
|
||||
sender: {
|
||||
name: 'Agent',
|
||||
},
|
||||
from: 'customer@example.com',
|
||||
to: 'customer1@example.com, customer2@example.com, zammad@example.com, customer2+2@example.com',
|
||||
cc: '',
|
||||
}
|
||||
result = {
|
||||
to: 'customer@example.com, customer1@example.com, customer2@example.com, customer2+2@example.com',
|
||||
cc: '',
|
||||
body: '',
|
||||
in_reply_to: 'message_id15',
|
||||
}
|
||||
email_addresses = [
|
||||
{
|
||||
email: 'zammad@example.com',
|
||||
},
|
||||
{
|
||||
email: 'zammad2@example.com',
|
||||
}
|
||||
]
|
||||
verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
|
||||
deepEqual(verify, result)
|
||||
|
||||
customer = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
email: 'customer@example.com',
|
||||
}
|
||||
agent = {
|
||||
login: 'login',
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
email: 'agent@example.com',
|
||||
}
|
||||
ticket = {
|
||||
customer: customer,
|
||||
}
|
||||
article = {
|
||||
message_id: 'message_id16',
|
||||
created_by: agent,
|
||||
type: {
|
||||
name: 'email',
|
||||
},
|
||||
sender: {
|
||||
name: 'Agent',
|
||||
},
|
||||
from: 'zammad@example.com',
|
||||
to: 'customer@example.com',
|
||||
cc: '',
|
||||
}
|
||||
result = {
|
||||
to: 'customer@example.com',
|
||||
cc: '',
|
||||
body: '',
|
||||
in_reply_to: 'message_id16',
|
||||
}
|
||||
email_addresses = [
|
||||
{
|
||||
email: 'zammad@example.com',
|
||||
},
|
||||
{
|
||||
email: 'zammad2@example.com',
|
||||
}
|
||||
]
|
||||
verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
|
||||
deepEqual(verify, result)
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue