From 92e9b1ce63ebce68dd34dd4d5a41071197a2bca1 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Tue, 23 Jul 2024 13:41:41 +0300 Subject: [PATCH] 1.1.41 show/hide unanswered_msgs_count --- .../etc_operations_for_chat_socket.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 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 06e7501..68ae342 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 @@ -15,18 +15,23 @@ function update_count_unread_messages(data) { list_unrd_parent[i].classList.toggle("showed"); } } - } else if(data.unanswered_msgs_count){ + } else if(data.unanswered_msgs_count || data.unanswered_msgs_count === 0){ for (let i = 0; i < list_unrd.length; i++){ list_unrd[i].innerHTML = data.unanswered_msgs_count.toString() - } - } else { - for (let i = 0; i < list_unrd.length; i++) { - let current_count = parseInt(list_unrd[i].innerHTML); - if (current_count === 0) { - list_unrd_parent[i].classList.toggle("showed"); + if(data.unanswered_msgs_count === 0){ + list_unrd_parent[i].classList.remove("showed"); } } } + + // else { + // for (let i = 0; i < list_unrd.length; i++) { + // let current_count = parseInt(list_unrd[i].innerHTML); + // if (current_count === 0 || selected_btn.dataset['ajaxUrl'] !== 'chats') { + // list_unrd_parent[i].classList.toggle("showed"); + // } + // } + // } } function play_required_beep (data,beep) {