{% macro participant_identity(offer, current_user, conversation, size='md') -%} {% set identity_class = 'participant-buyer' %} {% set role_label = 'Buyer' %} {% set display_name = 'You' %} {% if offer %} {% if offer.buyer_id == current_user.id %} {% set identity_class = 'participant-buyer' %} {% set role_label = 'Buyer' %} {% set display_name = 'You' %} {% elif offer.seller_id == current_user.id %} {% set identity_class = 'participant-seller' %} {% set role_label = 'Seller' %} {% set display_name = 'You' %} {% elif conversation and offer.buyer_id is not none and offer.buyer_id == conversation.buyer_id %} {% set identity_class = 'participant-buyer' %} {% set role_label = 'Buyer' %} {% set display_name = (offer.buyer.profile.full_name if offer.buyer and offer.buyer.profile and offer.buyer.profile.full_name else offer.buyer.email if offer.buyer else (conversation.buyer.profile.full_name if conversation.buyer and conversation.buyer.profile and conversation.buyer.profile.full_name else conversation.buyer.email if conversation.buyer else 'Participant')) %} {% elif conversation and offer.seller_id is not none and offer.seller_id == conversation.seller_id %} {% set identity_class = 'participant-seller' %} {% set role_label = 'Seller' %} {% set display_name = (offer.seller.profile.full_name if offer.seller and offer.seller.profile and offer.seller.profile.full_name else offer.seller.email if offer.seller else (conversation.seller.profile.full_name if conversation.seller and conversation.seller.profile and conversation.seller.profile.full_name else conversation.seller.email if conversation.seller else 'Participant')) %} {% elif offer.buyer_id is not none %} {% set identity_class = 'participant-buyer' %} {% set role_label = 'Buyer' %} {% set display_name = (offer.buyer.profile.full_name if offer.buyer and offer.buyer.profile and offer.buyer.profile.full_name else offer.buyer.email if offer.buyer else 'Participant') %} {% else %} {% set identity_class = 'participant-seller' %} {% set role_label = 'Seller' %} {% set display_name = (offer.seller.profile.full_name if offer.seller and offer.seller.profile and offer.seller.profile.full_name else offer.seller.email if offer.seller else 'Participant') %} {% endif %} {% endif %} {% set initial = (display_name[0] if display_name else 'P') %}