Skip to content

Commit

Permalink
bugfix(#721): Ignore counting user messages with event (#844)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
SanderSepp and Sander Sepp authored Aug 28, 2024
1 parent 3d86958 commit 3651ef7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DSL/Resql/get-cs-all-active-chats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FulfilledMessages AS (
),
MessageWithContent AS (
SELECT MAX(id) AS maxId
FROM message
FROM message
WHERE content <> ''
GROUP BY chat_base_id
),
Expand All @@ -46,7 +46,7 @@ MessagaeNotRatingOrForwardEvents AS (
GROUP BY chat_base_id
),
ActiveChats AS (
SELECT
SELECT
base_id,
customer_support_id,
customer_support_display_name,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3651ef7

Please sign in to comment.