(js) Fix handling of duplicate recipients

Fixes #4597
pull/246/head
Francis Lachapelle 2018-11-22 10:17:09 -05:00
parent 0b053a39e4
commit 4069158178
2 changed files with 7 additions and 4 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ Enhancements
Bug fixes
- [sogo-tool] fixed "manage-acl unsubscribe" command (#4591)
- [web] fixed handling of collapsed/expanded mail accounts (#4541)
- [web] fixed handling of duplicate recipients (#4597)
4.0.4 (2018-10-23)
------------------

View File

@ -298,7 +298,8 @@
contact.charCodeAt(i) == 32 || // space
contact.charCodeAt(i) == 44 || // ,
contact.charCodeAt(i) == 59) && // ;
emailRE.test(address)) {
emailRE.test(address) &&
recipients.indexOf(address) < 0) {
recipients.push(address);
address = '';
}
@ -306,8 +307,9 @@
address += contact.charAt(i);
}
}
if (address)
if (address && recipients.indexOf(address) < 0)
recipients.push(address);
return null;
}
@ -315,7 +317,7 @@
// If the list's members were already fetch, use them
if (angular.isDefined(contact.refs) && contact.refs.length) {
_.forEach(contact.refs, function(ref) {
if (ref.email.length)
if (ref.email.length && recipients.indexOf(ref.$shortFormat()) < 0)
recipients.push(ref.$shortFormat());
});
}
@ -323,7 +325,7 @@
list = Card.$find(contact.container, contact.c_name);
list.$id().then(function(listId) {
_.forEach(list.refs, function(ref) {
if (ref.email.length)
if (ref.email.length && recipients.indexOf(ref.$shortFormat()) < 0)
recipients.push(ref.$shortFormat());
});
});