From fc37bea98a63f3d64d0aa8ea85553a88f27dab48 Mon Sep 17 00:00:00 2001 From: SDE Date: Sun, 3 Dec 2023 20:49:07 +0300 Subject: [PATCH 1/2] 0.8.33 tickets text --- ChatServiceApp/models.py | 13 +++++++++++-- templates/widgets/w_request_tech_support.html | 6 +----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChatServiceApp/models.py b/ChatServiceApp/models.py index b9ab20a..827d729 100644 --- a/ChatServiceApp/models.py +++ b/ChatServiceApp/models.py @@ -38,8 +38,17 @@ class MsgGroup(BaseModel): manager = models.ForeignKey(User, verbose_name=_('Менеджер'), related_name='rel_msgGroups_for_manager', on_delete=models.SET_NULL, null=True) - def get_last_msg(self): - return self.rel_messages_for_group.all().order_by('-createDT').first() + def get_last_msg_txt(self): + msg = self.rel_messages_for_group.all().order_by('-createDT').first() + if not msg: + return self.text + + if msg.text: + return msg.text + elif msg.files: + return msg.files[0].file_name + + return self.name class Meta: verbose_name = _('Тикет') diff --git a/templates/widgets/w_request_tech_support.html b/templates/widgets/w_request_tech_support.html index a1445d0..5d94897 100644 --- a/templates/widgets/w_request_tech_support.html +++ b/templates/widgets/w_request_tech_support.html @@ -19,11 +19,7 @@
{# Текст последнего сообщени в чате (с размытием)#} - {% if ticket.get_last_msg.text %} - {{ ticket.get_last_msg.text }} - {% elif ticket.get_last_msg.files %} - {{ ticket.get_last_msg.files.0.file_name }} - {% endif %} + {{ ticket.get_last_msg_txt }}
From 4e7aa09c21f6643cfbe9b166323c7fe86e4472f7 Mon Sep 17 00:00:00 2001 From: SBD Date: Sun, 3 Dec 2023 20:53:48 +0300 Subject: [PATCH 2/2] 0.8.476 --- .../etc_operations_for_chat_socket.js | 17 ++++++++++------- static/js/user_profile_2.js | 4 +++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js index 0aac18f..200fbd2 100644 --- a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js +++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js @@ -1,13 +1,16 @@ function update_count_unread_messages (data) { - let list_unrd = document.querySelectorAll(".unredmessages_value_text") - let list_unrd_parent = document.querySelectorAll(".icon_unread_messages") - let i = 0 - for (i;i < list_unrd.length;i++){ - if (!list_unrd_parent[i].classList.contains("showed")){ - list_unrd_parent[i].classList.toggle("showed") + let selected_btn = document.querySelector(".selected") + if (selected_btn.dataset['ajaxUrl'] !== 'chats'){ + let list_unrd = document.querySelectorAll(".unredmessages_value_text") + let list_unrd_parent = document.querySelectorAll(".icon_unread_messages") + let i = 0 + for (i;i < list_unrd.length;i++){ + if (!list_unrd_parent[i].classList.contains("showed")){ + list_unrd_parent[i].classList.toggle("showed") + } + list_unrd[i].innerHTML = data.unread_msgs_count.toString() } - list_unrd[i].innerHTML = data.unread_msgs_count.toString() } } diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index 45fda44..12e09b1 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -95,7 +95,9 @@ function deleteMarkerMessages (el) { let marker = el.querySelectorAll(".icon_unread_messages") if (marker.length > 0){ marker[0].classList.remove("showed") - marker[1].classList.remove("showed") + if (marker[1]){ + marker[1].classList.remove("showed") + } } }