Fix: убрана лишняя запятая в именах участников чата
- Исправлен шаблон chat_list.html для личных чатов
- Использован {% cycle %} для правильного разделения имен участников
- Теперь запятая не отображается перед первым именем
This commit is contained in:
parent
dc4e983a74
commit
2f9d3a6ee7
@ -56,7 +56,7 @@ def create_message_notifications(sender, instance, created, **kwargs):
|
||||
title=f'Вас упомянул {author.get_full_name() or author.username}',
|
||||
message=truncate_message(content, 100),
|
||||
content_object=instance,
|
||||
action_url=f'/communications/chat/{chat.id}/?message={instance.id}',
|
||||
action_url=f'/communications/chats/{chat.id}/?message={instance.id}',
|
||||
metadata={
|
||||
'chat_id': chat.id,
|
||||
'chat_name': get_chat_name(chat),
|
||||
@ -80,7 +80,7 @@ def create_message_notifications(sender, instance, created, **kwargs):
|
||||
title=f'{author.get_full_name() or author.username} ответил на ваше сообщение',
|
||||
message=truncate_message(content, 100),
|
||||
content_object=instance,
|
||||
action_url=f'/communications/chat/{chat.id}/?message={instance.id}',
|
||||
action_url=f'/communications/chats/{chat.id}/?message={instance.id}',
|
||||
metadata={
|
||||
'chat_id': chat.id,
|
||||
'chat_name': get_chat_name(chat),
|
||||
@ -109,7 +109,7 @@ def create_message_notifications(sender, instance, created, **kwargs):
|
||||
title=f'Новое сообщение от {author.get_full_name() or author.username}',
|
||||
message=truncate_message(content, 100),
|
||||
content_object=instance,
|
||||
action_url=f'/communications/chat/{chat.id}/',
|
||||
action_url=f'/communications/chats/{chat.id}/',
|
||||
metadata={
|
||||
'chat_id': chat.id,
|
||||
'chat_name': get_chat_name(chat),
|
||||
@ -152,7 +152,7 @@ def create_chat_added_notifications(sender, instance, action, pk_set, **kwargs):
|
||||
title=f'Вас добавили в чат',
|
||||
message=f'Вы были добавлены в чат "{get_chat_name(chat)}"',
|
||||
content_object=chat,
|
||||
action_url=f'/communications/chat/{chat.id}/',
|
||||
action_url=f'/communications/chats/{chat.id}/',
|
||||
metadata={
|
||||
'chat_id': chat.id,
|
||||
'chat_type': chat.type,
|
||||
|
||||
@ -187,12 +187,8 @@
|
||||
<div class="flex-grow-1 position-relative">
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<a href="{% url 'communications:chat_detail' chat.pk %}" class="feed-author text-decoration-none stretched-link">
|
||||
{% for u in chat.participants.all %}
|
||||
{% if u != user %}
|
||||
{% if not forloop.first %}, {% endif %}
|
||||
{{ u.get_full_name|default:u.username }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% comment %}Показываем имена участников (кроме текущего){% endcomment %}
|
||||
{% for u in chat.participants.all %}{% if u.id != user.id %}{% cycle '' ', ' %}{{ u.get_full_name|default:u.username }}{% endif %}{% endfor %}
|
||||
</a>
|
||||
<span class="badge bg-light text-dark border">
|
||||
<i class="bi-chat-left-text"></i> {{ chat.messages.count }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user