Skip to content

Commit

Permalink
feat(mail): Add an option in Preferences to display full email instea…
Browse files Browse the repository at this point in the history
…d of name alone in mailboxes
  • Loading branch information
QHivert committed Nov 23, 2023
1 parent 8babb23 commit 2e670f7
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Documentation/SOGoInstallationGuide.asciidoc
Expand Up @@ -2490,6 +2490,9 @@ Defaults to `NO` when unset.
Defaults to `inline` when unset.
|U |SOGoMailDisplayFullEmail
|Show recipients or sender full email in mailboxes if set to `YES`. Default value is `NO`.
|U |SOGoMailHideInlineAttachments
|Hide inline message as attachements if set to `YES`. Default value is `NO`.
Expand Down
1 change: 1 addition & 0 deletions SoObjects/SOGo/SOGoDefaults.plist
Expand Up @@ -124,6 +124,7 @@
SOGoMailComposeMessageType = "html";
SOGoMailComposeFontSize = "0";
SOGoMailHideInlineAttachments = NO;
SOGoMailDisplayFullEmail = NO;
SOGoMailDisplayRemoteInlineImages = "never";
SOGoMailCertificateEnabled = YES;

Expand Down
3 changes: 3 additions & 0 deletions SoObjects/SOGo/SOGoUserDefaults.h
Expand Up @@ -156,6 +156,9 @@ extern NSString *SOGoPasswordRecoverySecondaryEmail;
- (void) setMailComposeFontSize: (int) newValue;
- (int) mailComposeFontSize;

- (void) setMailDisplayFullEmail: (BOOL *) newValue;
- (BOOL *) mailDisplayFullEmail;

- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue;
- (NSString *) mailDisplayRemoteInlineImages;

Expand Down
10 changes: 10 additions & 0 deletions SoObjects/SOGo/SOGoUserDefaults.m
Expand Up @@ -631,6 +631,16 @@ - (int) mailComposeFontSize
return [self integerForKey: @"SOGoMailComposeFontSize"];
}

- (void) setMailDisplayFullEmail: (BOOL *) newValue
{
[self setBool: newValue forKey: @"SOGoMailDisplayFullEmail"];
}

- (BOOL *) mailDisplayFullEmail;
{
return [self boolForKey: @"SOGoMailDisplayFullEmail"];
}

- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue
{
[self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"];
Expand Down
1 change: 1 addition & 0 deletions UI/PreferencesUI/English.lproj/Localizable.strings
Expand Up @@ -204,6 +204,7 @@
"Insert signature on new message" = "Insert signature on new message";
"Insert signature on reply" = "Insert signature on reply";
"Insert signature on forward" = "Insert signature on forward";
"Show recipients or sender full email in mailboxes" = "Show recipients or sender full email in mailboxes";
"Hide inline attachments" = "Hide inline attachments";

/* Base font size for messages composed in HTML */
Expand Down
1 change: 1 addition & 0 deletions UI/PreferencesUI/French.lproj/Localizable.strings
Expand Up @@ -204,6 +204,7 @@
"Insert signature on new message" = "Insérer la signature sur un nouveau message";
"Insert signature on reply" = "Insérer la signature sur une réponse";
"Insert signature on forward" = "Insérer la signature sur un transfert";
"Show recipients or sender full email in mailboxes" = "Afficher l'email complet du destinataire ou expéditeur dans les boîtes aux lettres";
"Hide inline attachments" = "Cacher les pièces jointes 'inline'";

/* Base font size for messages composed in HTML */
Expand Down
3 changes: 3 additions & 0 deletions UI/PreferencesUI/UIxJSONPreferences.m
Expand Up @@ -356,6 +356,9 @@ - (NSString *) jsonDefaults
[[defaults source] setObject: [NSNumber numberWithBool: [defaults mailAddOutgoingAddresses]] forKey: @"SOGoMailAddOutgoingAddresses"];


if (![[defaults source] objectForKey: @"SOGoMailDisplayFullEmail"])
[[defaults source] setObject: [NSNumber numberWithBool: [defaults mailDisplayFullEmail]] forKey: @"SOGoMailDisplayFullEmail"];

if (![[defaults source] objectForKey: @"SOGoMailComposeMessageType"])
[[defaults source] setObject: [defaults mailComposeMessageType] forKey: @"SOGoMailComposeMessageType"];

Expand Down
10 changes: 10 additions & 0 deletions UI/Templates/PreferencesUI/UIxPreferences.wox
Expand Up @@ -695,6 +695,16 @@
</md-checkbox>
</div>

<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailDisplayFullEmail"
ng-true-value="1"
ng-false-value="0"
label:aria-label="Show recipients or sender full email in mailboxes">
<var:string label:value="Show recipients or sender full email in mailboxes"/>
</md-checkbox>
</div>

<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailHideInlineAttachments"
Expand Down
13 changes: 11 additions & 2 deletions UI/WebServerResources/js/Mailer/Message.service.js
Expand Up @@ -273,7 +273,7 @@
* @desc Format the first address of a specific type with a short description.
* @returns a string of the name or the email of the envelope address type
*/
Message.prototype.$shortAddress = function (type) {
Message.prototype.$shortAddress = function (type, fullEmail) {
var address = '';
if (this[type]) {
if (angular.isString(this[type])) {
Expand All @@ -289,7 +289,16 @@
}
else if (this[type].length > 0) {
// We have an array of objects; pick the first one
address = this[type][0].name || this[type][0].email || '';
if(!fullEmail)
address = this[type][0].name || this[type][0].email || '';
else if(this[type][0].name && this[type][0].email)
address = this[type][0].name + ' <' + this[type][0].email +'>';
else if(this[type][0].name)
address = this[type][0].name;
else if(this[type][0].email)
address = this[type][0].email;
else
address = '';
}
}

Expand Down
Expand Up @@ -58,8 +58,8 @@
/**
* @ngInject
*/
sgMessageListItemMainController.$inject = ['$scope', '$element', '$parse', '$state', '$mdUtil', '$mdToast', 'Mailbox', 'Message', 'encodeUriFilter'];
function sgMessageListItemMainController($scope, $element, $parse, $state, $mdUtil, $mdToast, Mailbox, Message, encodeUriFilter) {
sgMessageListItemMainController.$inject = ['$scope', '$element', '$parse', '$state', '$mdUtil', '$mdToast', 'Mailbox', 'Message', 'encodeUriFilter', 'Preferences'];
function sgMessageListItemMainController($scope, $element, $parse, $state, $mdUtil, $mdToast, Mailbox, Message, encodeUriFilter, Preferences) {
var $ctrl = this;

this.$postLink = function () {
Expand All @@ -83,7 +83,6 @@
threadButton = angular.element(threadButton);
this.threadIconElement = threadButton.find('md-icon')[0];
this.threadCountElement = threadButton.find('span')[0];

this.priorityIconElement = contentDivElement.find('md-icon')[0];

if (Mailbox.$virtualMode) {
Expand Down Expand Up @@ -144,9 +143,9 @@

// Sender or recipient when in Sent or Draft mailbox
if ($ctrl.MailboxService.selectedFolder.isSentFolder || $ctrl.MailboxService.selectedFolder.isDraftsFolder)
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('to').encodeEntities();
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('to', Preferences.defaults.SOGoMailDisplayFullEmail).encodeEntities();
else
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('from').encodeEntities();
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('from', Preferences.defaults.SOGoMailDisplayFullEmail).encodeEntities();

// Priority icon
if ($ctrl.message.priority && $ctrl.message.priority.level < 3) {
Expand Down

0 comments on commit 2e670f7

Please sign in to comment.