notif.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {% for message in notif.messages %}
  2. <tr class="{{ "historical_message" if message.is_historical else "message" }}">
  3. <td class="sender_avatar">
  4. {% if loop.index0 == 0 or notif.messages[loop.index0 - 1].sender_name != notif.messages[loop.index0].sender_name %}
  5. {% if message.sender_avatar_url %}
  6. <img alt="" class="sender_avatar" src="{{ message.sender_avatar_url|mxc_to_http(32,32) }}" />
  7. {% else %}
  8. {% if message.sender_hash % 3 == 0 %}
  9. <img class="sender_avatar" src="https://vector.im/beta/img/76cfa6.png" />
  10. {% elif message.sender_hash % 3 == 1 %}
  11. <img class="sender_avatar" src="https://vector.im/beta/img/50e2c2.png" />
  12. {% else %}
  13. <img class="sender_avatar" src="https://vector.im/beta/img/f4c371.png" />
  14. {% endif %}
  15. <img class="sender_avatar" src="{{ message.sender_avatar_url }}" />
  16. {% endif %}
  17. {% endif %}
  18. </td>
  19. <td class="message_contents">
  20. {% if loop.index0 == 0 or notif.messages[loop.index0 - 1].sender_name != notif.messages[loop.index0].sender_name %}
  21. <div class="sender_name">{{ message.sender_name }}</div>
  22. {% endif %}
  23. <div class="message_body">
  24. {% if message.msgtype == "m.text" %}
  25. {{ message.body_text_html }}
  26. {% elif message.msgtype == "m.image" %}
  27. <img src="{{ message.image_url|mxc_to_http(640, 480, scale) }}" />
  28. {% elif message.msgtype == "m.file" %}
  29. <span class="filename">{{ message.body_text_plain }}</span>
  30. {% endif %}
  31. </div>
  32. </td>
  33. <td class="message_time">{{ message.ts|format_ts("%H:%M") }}</td>
  34. </tr>
  35. {% endfor %}
  36. <tr class="notif_link">
  37. <td></td>
  38. <td>
  39. <a href="{{ notif.link }}">View {{ room.title }}</a>
  40. </td>
  41. <td></td>
  42. </tr>