Repository navigation
feat(private-chat): message read confirmation feedback - #20722
antobinary merged 10 commits into
Conversation
Adds a view called `v_chat_private_read_feedback` to retrieve the last seen time of the recipient of a private chat.
Adds message read confirmation feedback feature to private chats. This feature uses the private chat recipient's `lastSeenAt' attribute to check which messages were read. Messages read are show in the chat with a check icon next to it. Feature behind a flag in settings.yml, which is disabled by default: - `public.chat.privateMessageReadFeedback.enabled`
Fixes poll chart message which was not using the full chat width due to previous changes in chat messages `flex-direction`.
|
Awesome addition! Thank you!! |
|
Nice feature @Arthurk12! The code looks good. However, I have a suggestion to improve performance. We've identified that Hasura can sometimes become a bottleneck due to the client creating too many subscriptions. To mitigate this, it would be beneficial to avoid creating a new subscription specifically for the I thought about adding My suggestion is to create a flag CREATE OR REPLACE VIEW "v_chat_message_private" as
SELECT cu."meetingId",
cu."userId",
cm."messageId",
cm."chatId",
cm."correlationId",
cm."chatEmphasizedText",
cm."message",
cm."messageType",
cm."messageMetadata",
cm."senderId",
cm."senderName",
cm."senderRole",
cm."createdAt",
case when chat_with."lastSeenAt" >= cm."createdAt" then true else false end "recipientHasSeen"
FROM chat_message cm
JOIN chat_user cu ON cu."meetingId" = cm."meetingId" AND cu."chatId" = cm."chatId"
LEFT JOIN "chat_user" chat_with ON cu."meetingId" = chat_with."meetingId"
AND cu."chatId" = chat_with."chatId"
AND cu."userId" != chat_with."userId"
WHERE cm."chatId" != 'MAIN-PUBLIC-GROUP-CHAT';what do you think? |
|
I agree! It seems to be a good performance optimization. I'll implement it. |
This commit changes the way the messages read by the recipient are tracked. The previous strategy required the client to calculate the read messages and as a consequence all messages of the given chat were re-rendered every time the recipient `lastSeenAt` time changed. The current strategy consists of calculating the read messages on the server(based on recipient `lastSeenAt`) and just expose to the client a boolean(`recipientHasSeen`) for each message that indicates whether it has already been read or not.
Automated tests Summary✅ All the CI tests have passed! |
gustavotrott
left a comment
There was a problem hiding this comment.
lgtm! well done @Arthurk12!

What does this PR do?
Adds message read confirmation feedback feature to private chats.
This feature uses the private chat recipient'sThis feature uses a property calculated on the server(only for private chats)lastSeenAtattribute to check which messages were read.recipientHasSeenwhich indicates the messages that have been read by the recipient. Messages read are show in the chat with a check icon next to it.Feature behind a flag in
settings.yml, which is disabled by default:public.chat.privateMessageReadFeedback.enabled