AnsweredAssumed Answered

Complaints about Recipients on Emails v8

Question asked by Francesca Shiekh on Nov 13, 2018

It took a good long while to get v8 live and now I have a bunch of complaints about the new Emails module, some I've been able to address but not all.

 

The major one I am stuck on is that the Recipients selection does not display the email address.

Users want the select-2 and final recipients in the email compose and detail views to display as:

Name <email@email.com

 

I dug through and found that 

modules/Emails/clients/base/fields/email-recipients/email-recipients.js 

in rendering the recipients, is formatting the select2-result

formatResult: _.bind(function(recipient) {
     var template = app.template.getField(this.type, 'select2-result', this.module);                   
     return template({
       value: recipient.toHeaderString({quote_name: true}),
       module: recipient.get('parent_type')
     });
}, this),

but the quote_name = true setting in the options passed to the toHeaderString function will force the display of name only.

the toHeaderString is defined in:

modules/EmailParticipants/clients/base/datas/model/model.js

    toHeaderString: function(options) {
        var name = this.get('parent_name') || '';
        var email = this.get('email_address') || '';

        options = options || {};

        // The name was erased, so let's use the label.
        if (_.isEmpty(name) && this.isNameErased()) {
            name = app.lang.get('LBL_VALUE_ERASED', this.module);
        }

        // The email was erased, so let's use the label.
        if (_.isEmpty(email) && this.isEmailErased()) {
            email = app.lang.get('LBL_VALUE_ERASED', this.module);
        }
        if (_.isEmpty(name)) {
            return email;
        }

        if (_.isEmpty(email)) {
            return name;
        }

        if (options.quote_name) {
            name = '"' + name + '"';
        }
        return name + ' <' + email + '>';
    },

 

Still, after experimenting and passing quote_name  false in

modules/Emails/clients/base/fields/email-recipients/email-recipients.js 

the email address does not display.

 

I can customize the select2 selection hbs but that does not appear to have an effect on the display of the recipients after the drawer is opened. If I default a recipient prior to opening the drawer (such as in my custom compose) then I will see the email address next to the name.

 

custom/modules/Emails/clients/base/fields/email-recipients/select2-selection.hbs

 

<span data-id="{{cid}}" {{#if email_address}}rel="tooltip" data-title="{{email_address}}" {{/if}}data-invalid="{{invalid}}" data-optout="{{opt_out}}" data-name-is-erased="{{name_is_erased}}" data-email-is-erased="{{email_is_erased}}">{{name}} &lt;{{email_address}}&gt;</span>

 

I am getting a bit lost in the meanders of the concept of "Recipient" and all the parts that make up a recipient...

Does anyone have suggestions or can enlighten me on how this all comes together.

 

It is really essential for me to be able to display the email address on the Email compose, the Email detail and the select2. 

 

thank you,
FrancescaS

Outcomes