Skip to content

feat(private-chat): message read confirmation feedback - #20722

Merged
antobinary merged 10 commits into
bigbluebutton:v3.0.x-releasefrom
Arthurk12:private-message-read-feedback
Jul 22, 2024
Merged

antobinary merged 10 commits into
bigbluebutton:v3.0.x-releasefrom
Arthurk12:private-message-read-feedback

Conversation

@Arthurk12

@Arthurk12 Arthurk12 commented Jul 18, 2024 •

Copy link
Copy Markdown
Member

What does this PR do?

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. This feature uses a property calculated on the server(only for private chats) recipientHasSeen which 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

private_message_read_feedback

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`.
@antobinary antobinary added this to the Release 3.0 milestone Jul 18, 2024
@antobinary

Copy link
Copy Markdown
Member

Awesome addition! Thank you!!

@gustavotrott

gustavotrott commented Jul 18, 2024 •

Copy link
Copy Markdown
Contributor

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 chat_private_read_feedback.

I thought about adding recipientLastSeenAt to v_chat_message_private, but it is not a good idea because it would change all the time forcing the client to receive this prop updated for all the messages every time it changes.

My suggestion is to create a flag recipientHasSeen that will be much more efficient, because once the recipient read it will not change anymore:

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?

@Arthurk12

Copy link
Copy Markdown
Member Author

I agree! It seems to be a good performance optimization. I'll implement it.
Thanks for pointing it out @gustavotrott!

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.
@Arthurk12
Arthurk12 requested a review from gustavotrott July 18, 2024 19:20
@gustavotrott

gustavotrott commented Jul 19, 2024 •

Copy link
Copy Markdown
Contributor

The text and icon are not vertically aligned properly

image

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@Arthurk12
Arthurk12 requested a review from gustavotrott July 22, 2024 13:32

@gustavotrott gustavotrott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! well done @Arthurk12!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants