Skip to content

Commit

Permalink
(js) Fix handling of duplicate recipients
Browse files Browse the repository at this point in the history
Fixes #4597
  • Loading branch information
cgx committed Nov 22, 2018
1 parent 0b053a3 commit 4069158
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
------------------
Expand Down
10 changes: 6 additions & 4 deletions UI/WebServerResources/js/Mailer/MessageEditorController.js
Expand Up @@ -298,32 +298,34 @@
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 = '';
}
else {
address += contact.charAt(i);
}
}
if (address)
if (address && recipients.indexOf(address) < 0)
recipients.push(address);

return null;
}

if (contact.$isList({expandable: true})) {
// 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());
});
}
else {
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());
});
});
Expand Down

0 comments on commit 4069158

Please sign in to comment.