{% import 'OroEmailBundle::macros.html.twig' as EA %}

{% set folders = record.getValue('folders') %}
{% set thread = record.getValue('thread') %}
{% if thread is not null  %}
    {% set recipients = oro_get_email_thread_recipients(thread) %}
{% else %}
    {% set recipients = record.getValue('recipients') %}
{% endif %}

<span class="nowrap">
{% if folders|length > 0 %}
    {% set folder = folders[0] %}
    {% if folder.type == 'sent' %}
        <span class="icon grid">
            <i class="icon-signout"></i>
        </span>
    {% elseif folder.type == 'inbox' %}
        <span class="icon grid">
            <i class="icon-signin"></i>
        </span>
    {% endif %}
{% endif %}

{% if (recipients|length > 0 and recipients|length < 3) %}
    <strong>{{ EA.email_participants_name(recipients, true, false) }}</strong>
{% else %}
    <strong>
        {% set firstEmail = recipients[0] %}
        {% set lastEmail = recipients[recipients|length - 1] %}
        {{
            EA.email_participant_name_or_me(firstEmail.emailAddress, firstEmail.name, true, false)
        }}..{{
            EA.email_participant_name_or_me(lastEmail.emailAddress, lastEmail.name, true, false)
        }}
        ({{ recipients|length }})
    </strong>
{% endif %}
</span>

{% import 'OroEmailBundle::macros.html.twig' as EA %}

{% set folders = record.getValue('folders') %}
{% set thread = record.getValue('thread') %}
{% if thread is not null  %}
    {% set recipients = oro_get_email_thread_recipients(thread) %}
{% else %}
    {% set recipients = record.getValue('recipients') %}
{% endif %}

<span class="nowrap">
{% if folders|length > 0 %}
    {% set folder = folders[0] %}
    {% if folder.type == 'sent' %}
        <span class="icon grid">
            <i class="icon-signout"></i>
        </span>
    {% elseif folder.type == 'inbox' %}
        <span class="icon grid">
            <i class="icon-signin"></i>
        </span>
    {% endif %}
{% endif %}

{% if (recipients|length > 0 and recipients|length < 3) %}
    <strong>{{ EA.email_participants_name(recipients, true, false) }}</strong>
{% else %}
    <strong>
        {% set firstEmail = recipients[0] %}
        {% set lastEmail = recipients[recipients|length - 1] %}
        {{
            EA.email_participant_name_or_me(firstEmail.emailAddress, firstEmail.name, true, false)
        }}..{{
            EA.email_participant_name_or_me(lastEmail.emailAddress, lastEmail.name, true, false)
        }}
    </strong>
{% endif %}
{% if thread is not null and thread.emails|length > 1 %}
    <strong>({{ thread.emails|length }})</strong>
{% endif %}
</span>

Prepare data for my emails grid
CRM-2893: Prepare data for my emails grid
