From 36303bef9d62aa99ab2d9f52d7ffdfb4cb12ebef Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 25 May 2022 13:31:03 -0400 Subject: [PATCH] fix(preferences): keep mail identities when none is provided when saving --- UI/PreferencesUI/UIxPreferences.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 6450cf92b..5717191f8 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1449,7 +1449,7 @@ static NSArray *reminderValues = nil; if ((v = [o objectForKey: @"defaults"])) { NSMutableDictionary *sanitizedLabels; - NSArray *allKeys, *accounts; + NSArray *allKeys, *accounts, *identities; NSDictionary *newLabels; NSString *name; id loginModule; @@ -1523,6 +1523,17 @@ static NSArray *reminderValues = nil; if ([[[user userDefaults] mailCertificate] length]) [v setObject: [[user userDefaults] mailCertificate] forKey: @"SOGoMailCertificate"]; + // + // Keep the original mail identities if none is provided + // + identities = [v objectForKey: @"SOGoMailIdentities"]; + if (!identities || ![identities isKindOfClass: [NSArray class]]) + { + identities = [[user userDefaults] mailIdentities]; + if ([identities count]) + [v setObject: identities forKey: @"SOGoMailIdentities"]; + } + // // We sanitize our auxiliary mail accounts //