Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Felamimail/js): resolve recipient name with email info
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheng-dev committed May 3, 2023
1 parent 09e8460 commit 4ed3143
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tine20/Felamimail/js/ContactSearchCombo.js
Expand Up @@ -67,7 +67,7 @@ Tine.Felamimail.ContactSearchCombo = Ext.extend(Tine.Addressbook.SearchCombo, {
let value = _.get(values, field) ?? '';

if (field === 'email' && value !== '') {
value = `( ${value} )`;
value = `<${value}>`;
}

return Ext.util.Format.htmlEncode(value);
Expand Down
18 changes: 13 additions & 5 deletions tine20/Felamimail/js/MessageEditDialog.js
Expand Up @@ -820,19 +820,27 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
initReplyRecipients: async function () {
// should resolve recipients here , save data
const replyTo = this.replyTo.get('headers')['reply-to'];

if (replyTo) {
this.to = replyTo;
} else {
const toEmail = this.replyTo.get('from_email');
const toName = this.replyTo.get('from_name');
this.to = (toName && toName !== toEmail) ? `${toName} <${toEmail}>` : toEmail;
const email = this.replyTo.get('from_email');
const name = this.replyTo.get('from_name');
this.to = [{
'email': email ?? '',
'email_type': '',
'type': '',
'n_fileas': '',
'name': name !== email ? name : '',
'record_id': ''
}];

// we might get the recipient token from server
if (this.replyTo.get('from')) {
this.to = this.replyTo.get('from');
}
}

if (this.replyToAll) {
if (!Ext.isArray(this.to)) {
this.to = [this.to];
Expand Down
5 changes: 3 additions & 2 deletions tine20/Felamimail/js/RecipientGrid.js
Expand Up @@ -348,13 +348,14 @@ Tine.Felamimail.RecipientGrid = Ext.extend(Ext.grid.EditorGridPanel, {
return '';
}

const renderEmail = values.email !== '' && values.name !== '' ? ` < ${values.email} >` : values.email;
const renderEmail = values.email !== '' && values.name !== '' ? ` <${values.email}>` : values.email;
const iconCls = this.searchCombo.resolveAddressIconCls(values);
const note = values?.note && values.note !== '' ? `( ${values.note} )` : '';

return iconCls +
'<span class="tinebase-contact-link">'
+ '<b>' + Ext.util.Format.htmlEncode(`${values.name}${renderEmail}`) + '</b>'
+ Ext.util.Format.htmlEncode(`${values.name}`)
+ '<b>' + Ext.util.Format.htmlEncode(`${renderEmail}`) + '</b>'
+ ' ' + Ext.util.Format.htmlEncode(note)
+ '</span>'
+ '<div class="tinebase-contact-link-wait"></div>';
Expand Down

0 comments on commit 4ed3143

Please sign in to comment.