From 98463f2ff275f08a27701dc26568d90b49683090 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 19 Feb 2019 14:50:49 -0500 Subject: [PATCH] (fix) sent messages cannot be replied to their BCC email addresses (fixes #4460) --- NEWS | 1 + SoObjects/Mailer/SOGoDraftObject.m | 20 +++++++++++++------ .../js/Mailer/Message.service.js | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 87dcc746b..ea2d18ab0 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Bug fixes - [web] reflect active locale in HTML lang attribute (#4660) - [web] allow scroll of login page on small screen (#4035) - [web] fixed saving of email address for external calendar notifications (#4630) + - [web] sent messages cannot be replied to their BCC email addresses (#4460) - [core] ignore transparent events in time conflict validation (#4539) - [core] fixed yearly recurrence calculator when starting from previous year - [core] changes to contacts are now propagated to lists (#850, #4301, #4617) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 4621c8450..bae451dbd 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -752,25 +752,33 @@ static NSString *userAgent = nil; [_info removeObjectForKey: @"cc"]; } - /* CC processing if we reply-to-all: - we add all 'to' and 'cc' fields */ + /* CC processing if we reply-to-all: - we add all 'to', 'cc' and 'bcc' fields */ if (_replyToAll) { - to = [[NSMutableArray alloc] init]; + to = [NSMutableArray array]; [addrs setArray: [_envelope to]]; [self _purgeRecipients: allRecipients - fromAddresses: addrs]; + fromAddresses: addrs]; [self _addEMailsOfAddresses: addrs toArray: to]; [self _addRecipients: addrs toArray: allRecipients]; [addrs setArray: [_envelope cc]]; [self _purgeRecipients: allRecipients - fromAddresses: addrs]; + fromAddresses: addrs]; [self _addEMailsOfAddresses: addrs toArray: to]; - + [self _addRecipients: addrs toArray: allRecipients]; [_info setObject: to forKey: @"cc"]; - [to release]; + if ([[_envelope bcc] count]) + { + to = [NSMutableArray array]; + [addrs setArray: [_envelope bcc]]; + [self _purgeRecipients: allRecipients + fromAddresses: addrs]; + [self _addEMailsOfAddresses: addrs toArray: to]; + [_info setObject: to forKey: @"bcc"]; + } } } diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js index 4e676b76f..62b71d7d9 100644 --- a/UI/WebServerResources/js/Mailer/Message.service.js +++ b/UI/WebServerResources/js/Mailer/Message.service.js @@ -275,7 +275,7 @@ */ Message.prototype.allowReplyAll = function() { var recipientsCount = 0; - recipientsCount = _.reduce(['to', 'cc'], _.bind(function(count, type) { + recipientsCount = _.reduce(['to', 'cc', 'bcc'], _.bind(function(count, type) { if (this[type]) return count + this[type].length; else