Allow custom email to be one of the user's profile

Fixes #3551
pull/222/head
Francis Lachapelle 2016-10-03 10:29:30 -04:00
parent f0a368e42c
commit b4676ce439
3 changed files with 19 additions and 7 deletions

1
NEWS
View File

@ -16,6 +16,7 @@ Enhancements
- [web] added sort by arrival date in Mail module (#708) - [web] added sort by arrival date in Mail module (#708)
- [web] restored "now" line in Calendar module - [web] restored "now" line in Calendar module
- [web] updated CKEditor to version 4.5.11 - [web] updated CKEditor to version 4.5.11
- [web] allow custom email address to be one of the user's profile (#3551)
- [eas] propagate message submission errors to EAS clients (#3774) - [eas] propagate message submission errors to EAS clients (#3774)
Bug fixes Bug fixes

View File

@ -626,11 +626,12 @@
*encryption, *scheme, *action, *query, *customEmail, *defaultEmail, *sieveServer; *encryption, *scheme, *action, *query, *customEmail, *defaultEmail, *sieveServer;
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *mailSettings; NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *mailSettings;
NSNumber *port; NSNumber *port;
NSMutableArray *identities; NSMutableArray *identities, *mails;
NSArray *mails, *delegators, *delegates; NSArray *delegators, *delegates;
NSURL *url, *cUrl; NSURL *url, *cUrl;
unsigned int count, max, default_identity; unsigned int count, max, default_identity;
NSInteger defaultPort; NSInteger defaultPort;
NSUInteger index;
[self userDefaults]; [self userDefaults];
@ -712,7 +713,7 @@
defaultEmail = [NSString stringWithFormat: @"%@@%@", [self loginInDomain], [self domain]]; defaultEmail = [NSString stringWithFormat: @"%@@%@", [self loginInDomain], [self domain]];
default_identity = 0; default_identity = 0;
identities = [NSMutableArray new]; identities = [NSMutableArray new];
mails = [self allEmails]; mails = [NSMutableArray arrayWithArray: [self allEmails]];
[mailAccount setObject: [mails objectAtIndex: 0] forKey: @"name"]; [mailAccount setObject: [mails objectAtIndex: 0] forKey: @"name"];
replyTo = [_defaults mailReplyTo]; replyTo = [_defaults mailReplyTo];
@ -729,6 +730,17 @@
{ {
if ([customEmail length] == 0) if ([customEmail length] == 0)
customEmail = [mails objectAtIndex: 0]; customEmail = [mails objectAtIndex: 0];
else if ([fullName length] == 0)
{
// Custom email but default fullname; if the custom email is
// one of the user's emails, remove the duplicated entry
index = [mails indexOfObject: customEmail];
if (index != NSNotFound)
{
[mails removeObjectAtIndex: index];
max--;
}
}
if ([fullName length] == 0) if ([fullName length] == 0)
{ {

View File

@ -1860,10 +1860,9 @@ static NSArray *reminderValues = nil;
value = [[identity objectForKey: @"email"] value = [[identity objectForKey: @"email"]
stringByTrimmingSpaces]; stringByTrimmingSpaces];
/* We make sure that the "custom" value is different from the values /* We make sure that the "custom" value is different from the system email */
returned by the user directory service. */ if ([value length] == 0)
if ([value length] == 0 || [[user systemEmail] isEqualToString: value])
|| [[user allEmails] containsObject: value])
value = nil; value = nil;
if (value) if (value)