dont mention urself in chat

pull/232/head
Aevann 2024-08-06 04:20:39 +03:00
parent 82b33f5247
commit 315c18cd35
2 changed files with 12 additions and 8 deletions

View File

@ -46,7 +46,7 @@ socket.on('speak', function(json) {
}
chatline.classList.remove('chat-mention');
if (text_html.includes(`<a href="/id/${vid}"`) || text.match(group_names_pattern)) {
if (json.user_id != vid && (text_html.includes(`<a href="/id/${vid}"`) || text.match(group_names_pattern))) {
chatline.classList.add('chat-mention');
}

View File

@ -290,15 +290,19 @@
{% endmacro %}
{% macro chat_line_template(id, m, vlink, group_memberships_names) %}
{% set mentioned = m and vlink in m.text_html or (m and m.quoted_message and m.quoted_message.user_id == v.id) %}
{% set ns = namespace() %}
{% if not mentioned %}
{% for group_name in group_memberships_names %}
{% if (group_name == 'everyone' and '<a href="/users"' in m.text_html) or (group_name == 'jannies' and '<a href="/admins"' in m.text_html) or '<a href="/!' ~ group_name ~ '"' in m.text_html %}
{% set ns.group_mentioned = True %}
{% endif %}
{% endfor %}
{% if m and m.user_id != v.id %}
{% set ns.mentioned = m and vlink in m.text_html or (m and m.quoted_message and m.quoted_message.user_id == v.id) %}
{% if not ns.mentioned %}
{% for group_name in group_memberships_names %}
{% if (group_name == 'everyone' and '<a href="/users"' in m.text_html) or (group_name == 'jannies' and '<a href="/admins"' in m.text_html) or '<a href="/!' ~ group_name ~ '"' in m.text_html %}
{% set ns.group_mentioned = True %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
<div class="chat-line {% if mentioned or ns.group_mentioned %}chat-mention{% endif %}" {% if m %}id="{{id}}"{% endif %}>
<div class="d-flex align-items-center">
<div class="text-muted chat-line-content">