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") + } } }