From eb464157113021f6771b171c23bb638d9efced25 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 12 Aug 2021 13:40:35 -0400 Subject: [PATCH] fix(mail(js)): hide sign and encrypt options if not usable When composing a message, don't offer to sign nor encrypt the message if user has not uploaded a certificate or if S/MIME is disabled. --- SoObjects/SOGo/SOGoUser.m | 2 +- UI/PreferencesUI/UIxJSONPreferences.m | 2 +- UI/Templates/MailerUI/UIxMailEditor.wox | 12 ++++++------ UI/WebServerResources/js/Mailer/Account.service.js | 12 +++++++++++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 90d1c3ddf..dc9b7773a 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -945,7 +945,7 @@ [mailAccount setObject: delegates forKey: @"delegates"]; // 9. Security - if ([[_defaults mailCertificate] length]) + if ([[self domainDefaults] mailCertificateEnabled] && [[_defaults mailCertificate] length]) { security = [NSMutableDictionary new]; diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 6905b46bc..602c5a6bd 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -410,7 +410,7 @@ static SoProduct *preferencesProduct = nil; { auxAccount = [accounts objectAtIndex: i]; security = [auxAccount objectForKey: @"security"]; - if (security) + if (security && [domainDefaults mailCertificateEnabled]) { limitedSecurity = [NSMutableDictionary dictionaryWithDictionary: security]; if ([limitedSecurity objectForKey: @"certificate"]) diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index 85e34c3f1..7c36b1546 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -231,15 +231,15 @@ - + - + - + @@ -248,7 +248,7 @@ - + {{ editor.message.editable.priority == 1 ? 'check' : null }} @@ -286,7 +286,7 @@