| 1 | {% import 'components/avatar.html' as avatar with context %} |
| 2 | |
| 3 | {% if chat_type == "group" %} |
| 4 | {% set own_msg = msg.from_==own_local_jid %} |
| 5 | {% else %} |
| 6 | {% set own_msg = msg.from_|bare_jid==own_local_jid|bare_jid %} |
| 7 | {% endif %} |
| 8 | |
| 9 | <div |
| 10 | id="{{msg.id}}" |
| 11 | class="media chat-message msg_{{msg.type}} {{'own_msg' if own_msg}} {{ 'is-retracted' if msg.extra.retracted }}" |
| 12 | aria-label="{{ 'Retracted Message' if msg.extra.retracted else 'Chat Message' }}" |
| 13 | data-from='{{msg.from_}}' |
| 14 | {% if msg.extra.editions %}data-editions='{{msg.extra.editions|tojson}}'{% endif %} |
| 15 | {% if msg.extra.thread %}data-thread='{{msg.extra.thread}}'{% endif %} |
| 16 | > |
| 17 | {%- if msg.type != "info" %} |
| 18 | {%- set author = identities[msg.from_].nicknames[0] | default(msg.from_) -%} |
| 19 | <figure class="media-left"> |
| 20 | {{ avatar.avatar(msg.from_) }} |
| 21 | </figure> |
| 22 | {% endif -%} |
| 23 | <div class="media-content is-relative"> |
| 24 | {%- if msg.type != "info" %} |
| 25 | |
| 26 | <div> |
| 27 | |
| 28 | <span class="author" id="msg_author_{{msg.id}}">{{author}}</span> |
| 29 | <span class="date" id="msg_date_{{msg.id}}">{{(msg.extra.updated or msg.timestamp)|date_fmt('short', tz_name=tz_name)}}</span> |
| 30 | <span id="status_icons_{{msg.id}}" class="status-icons level-item has-padding-left"> |
| 31 | {% if msg.reply_to or msg.extra.thread %} |
| 32 | {{ icon('comment-dots', cls='icon is-small message-thread') }} |
| 33 | {% endif %} |
| 34 | {% if msg.extra.editions %} |
| 35 | {{ icon('pencil', cls='icon is-small message-editions') }} |
| 36 | {% endif %} |
| 37 | {% if msg.encrypted %} |
| 38 | {{ icon('lock', cls='icon is-small has-text-success') }} |
| 39 | {% else %} |
| 40 | {{ icon('unlock', cls='icon is-small has-text-danger') }} |
| 41 | {% endif %} |
| 42 | {% if msg.received %} |
| 43 | {{ icon('check', cls='icon is-small has-text-link') }} |
| 44 | {% endif %} |
| 45 | {% if msg.edited %} |
| 46 | {{ icon('pencil', cls='icon is-small has-text-info') }} |
| 47 | {% endif %} |
| 48 | </span> |
| 49 | </div> |
| 50 | |
| 51 | {% if msg.extra.origin or msg.extra.get("is-bot") %} |
| 52 | <div class="tags mb-0 pb-1"> |
| 53 | {% if msg.extra.origin == "smtp" %} |
| 54 | |
| 55 | <span data-type="{{msg.extra.origin}}" class="message-origin tag is-hoverable is-light">🖂 {% trans %}email{% endtrans %}</span> |
| 56 | {% else %} |
| 57 | <span class="message-origin tag is-hoverable is-light">{{msg.extra.origin}}</span> |
| 58 | {% endif %} |
| 59 | {% if msg.extra.get("is-bot") %} |
| 60 | <span data-type="{{msg.extra.origin}}" class="tag is-light">🤖 bot</span> |
| 61 | {% endif %} |
| 62 | </div> |
| 63 | {% endif %} |
| 64 | |
| 65 | {% endif -%} |
| 66 | <div class="message-core"> |
| 67 | <p class="message-body {{ "has-text-info" if msg.type=="info" or msg.extra.retracted }} m-0" id="message-body_{{msg.id}}"> |
| 68 | {%- if msg.extra.retracted %} |
| 69 | {% trans %}This message has been retracted.{% endtrans %} |
| 70 | {% else %} |
| 71 | {{- msg.html or (msg.text|e|urlize|safe) -}} |
| 72 | {% endif -%} |
| 73 | </p> |
| 74 | |
| 75 | <div class="url-previews is-hidden"> |
| 76 | <div class="icon-container"></div> |
| 77 | </div> |
| 78 | |
| 79 | <div |
| 80 | class="level mb-0 mt-1 message-footer {{ "is-hidden" if msg.extra.retracted }}" |
| 81 | > |
| 82 | <div class="level-left"> |
| 83 | {% if msg.extra.keywords %} |
| 84 | <div class="tags pb-1"> |
| 85 | {% for keyword in msg.extra.keywords %} |
| 86 | <span class="message-keyword tag is-hoverable is-info">{{keyword}}</span> |
| 87 | {% endfor %} |
| 88 | </div> |
| 89 | {% endif %} |
| 90 | </div> |
| 91 | <div class="level-right message-actions"> |
| 92 | {# {{ icon('share-nodes', cls='icon is-small action-button', id='msg_share_' + msg.id) }} #} |
| 93 | {{ icon('reply', cls='icon is-small action-button reply-button')}} |
| 94 | {{ icon('regular face-smile', cls='icon is-small action-button reaction-button') }} |
| 95 | {{ icon('ellipsis', cls='icon is-small action-button extra-button') }} |
| 96 | </div> |
| 97 | </div> |
| 98 | |
| 99 | <div id="msg_reactions_{{msg.id}}"> |
| 100 | {% if msg.extra.reactions is defined %} |
| 101 | {% set reactions = msg.extra.get("reactions") %} |
| 102 | {% include 'components/reactions.html' %} |
| 103 | {% endif %} |
| 104 | </div> |
| 105 | </div> |
| 106 | {% if msg.attachments %} |
| 107 | <div class="message-attachments pt-2"> |
| 108 | {%- for attachment in msg.attachments %} |
| 109 | <figure class="image message-attachment"> |
| 110 | {%- if not attachment.url -%} |
| 111 | <div class="notification is-warning"> |
| 112 | <div class="is-size-6 has-text-weight-semibold mb-1"> |
| 113 | {% trans name=attachment.name %}Attachment: {{name}}{% endtrans %} |
| 114 | </div> |
| 115 | |
| 116 | <div class="is-size-7 mb-1"> |
| 117 | {% trans %}Cannot be opened as there are no sources available.{% endtrans %} |
| 118 | </div> |
| 119 | |
| 120 | </div> |
| 121 | {%- else -%} |
| 122 | {%- if attachment.media_type|media_type_main == 'image' %} |
| 123 | <img src="{{attachment.url}}" alt="{{attachment.name}}"> |
| 124 | {%- else %} |
| 125 | {{ icon('doc', cls='icon') }} |
| 126 | {%- endif %} |
| 127 | <figcaption class="has-text-centered is-size-7"> |
| 128 | <a href="{{attachment.url}}" target="_blank" class="has-text-grey">{{attachment.name}}</a> |
| 129 | </figcaption> |
| 130 | {%- endif -%} |
| 131 | </figure> |
| 132 | {%- endfor %} |
| 133 | </div> |
| 134 | {% endif %} |
| 135 | </div> |
| 136 | </div> |