From 32fcd432f29a6b8b387fcbd0eb1f0c0d2ef6972c Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 17 Mar 2016 13:30:29 +0100 Subject: [PATCH] Improved reply all detection. --- .../ticket_zoom/article_actions.coffee | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee index 1b83f8a00..8b3c12112 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee @@ -90,7 +90,25 @@ class App.TicketZoomArticleActions extends App.Controller localRecipients = emailAddresses.parseAddressList(article.cc) if localRecipients recipients = recipients.concat localRecipients - if recipients.length > 1 + + # remove system addresses + localAddresses = App.EmailAddress.all() + forgeinRecipients = [] + recipientUsed = {} + for recipient in recipients + localRecipientAddeess = recipient.address.toString().toLowerCase() + if !recipientUsed[localRecipientAddeess] + recipientUsed[localRecipientAddeess] = true + localAddess = false + for address in localAddresses + if localRecipientAddeess is address.email.toString().toLowerCase() + recipientUsed[localRecipientAddeess] = true + localAddess = true + if !localAddess + forgeinRecipients.push recipient + + # check if reply all is neede + if forgeinRecipients.length > 1 actions.push { name: 'reply all' type: 'emailReplyAll'