From 0d545172d661cac4b4d8b8b54b67851c658d5530 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 8 Aug 2023 16:39:01 +0300 Subject: [PATCH] 0.1.47 chat routines --- AuthApp/js_views.py | 18 ++++++++++++++++++ ChatServiceApp/js_views.py | 2 +- templates/blocks/profile/b_chats.html | 2 +- .../blocks/profile/b_messages_container.html | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index d3c1fde..43a58ea 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -29,7 +29,25 @@ def chats_ajax(request): if request.method != 'POST': raise Http404 + from ChatServiceApp.funcs import get_chat_receivers_for_user, get_msgs_for_chat_w_users + + receivers = get_chat_receivers_for_user(request.user) + + cur_chat_msgs = None + + # try: + # cur_receiver = User.objects.get(id=user_id) + # if not cur_receiver in receivers: + # receivers.insert(0, cur_receiver) + # cur_chat_msgs = get_msgs_for_chat_w_users(request.user, cur_receiver) + # except User.DoesNotExist: + # cur_receiver = None + Dict = { + 'page': 'chat', + # 'cur_receiver': cur_receiver, + 'receivers': receivers, + # 'messages': cur_chat_msgs } html = render_to_string('blocks/profile/b_chats.html', Dict, request=request) diff --git a/ChatServiceApp/js_views.py b/ChatServiceApp/js_views.py index 3658966..4db502e 100644 --- a/ChatServiceApp/js_views.py +++ b/ChatServiceApp/js_views.py @@ -94,7 +94,7 @@ def update_chat_ajax(request): res_Dict.update({ 'messages': msgs, 'cur_receiver': receiver, - 'modifiedDT': msgs[0].modifiedDT + # 'modifiedDT': msgs[0].modifiedDT }) html = render_to_string(tpl_name, res_Dict, request=request) diff --git a/templates/blocks/profile/b_chats.html b/templates/blocks/profile/b_chats.html index 220acc3..8ba34e8 100644 --- a/templates/blocks/profile/b_chats.html +++ b/templates/blocks/profile/b_chats.html @@ -70,7 +70,7 @@ Чаты:
{% for item in receivers %} - {% include "widgets/w_chat_right_panel_tickets.html" %} + {% include "widgets/w_chat_right_panel_users.html" %} {% endfor %}
diff --git a/templates/blocks/profile/b_messages_container.html b/templates/blocks/profile/b_messages_container.html index fa855ae..b7d5380 100644 --- a/templates/blocks/profile/b_messages_container.html +++ b/templates/blocks/profile/b_messages_container.html @@ -2,7 +2,7 @@ -{% if not messages %} +{% if not messages and ticket %} {% include "widgets/w_message.html" %} {% else %} {% for msg in messages %}