From 3651ef7c282dce63627f9b1fddd602c4f2145d97 Mon Sep 17 00:00:00 2001 From: SanderSepp Date: Wed, 28 Aug 2024 12:52:13 +0300 Subject: [PATCH] bugfix(#721): Ignore counting user messages with event (#844) - Admin panel needs actual user message count to trigger notification sounds and toasts. When user reads admin message, "message-read" event is inserted to message table on user's behalf. This should not count as user message. Co-authored-by: Sander Sepp --- DSL/Resql/get-cs-all-active-chats.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DSL/Resql/get-cs-all-active-chats.sql b/DSL/Resql/get-cs-all-active-chats.sql index 8dbdd297..81e2bfe2 100644 --- a/DSL/Resql/get-cs-all-active-chats.sql +++ b/DSL/Resql/get-cs-all-active-chats.sql @@ -25,7 +25,7 @@ FulfilledMessages AS ( ), MessageWithContent AS ( SELECT MAX(id) AS maxId - FROM message + FROM message WHERE content <> '' GROUP BY chat_base_id ), @@ -46,7 +46,7 @@ MessagaeNotRatingOrForwardEvents AS ( GROUP BY chat_base_id ), ActiveChats AS ( - SELECT + SELECT base_id, customer_support_id, customer_support_display_name, @@ -97,6 +97,7 @@ CustomerMessages AS ( SELECT chat_base_id, COUNT(id) AS messages_count FROM message WHERE message.author_role = 'end-user' + AND (message.event = '' OR message.event IS NULL) GROUP BY chat_base_id ) SELECT c.base_id AS id,