Skip to content

Fix read receipt behavior when the timeline is opened. #4679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2025

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented May 5, 2025

Content

Ensure that ReadReceipt is sent when new messages are coming in and user is on the timeline.

Motivation and context

Closes #4662

Screenshots / GIFs

Tests

  • Alice opens a room R she shares with Bob
  • Bob open the same room
  • Bob sees that Alice RR is at the bottom of the timeline
  • Bob sends a new message
  • Alice views the message from Bob and does not do anything else particular
  • Bob sees Alice's RR moving down as expected. This PR fixes this, previously Alice RR did not move.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

bmarty added 2 commits May 5, 2025 10:12
- filter Virtual item regarding typing to compute NewEventState
- always scroll, since the latest event is always the typing notification (but with 0 height). This triggers the sending of RR.
@bmarty bmarty requested a review from a team as a code owner May 5, 2025 13:24
@bmarty bmarty removed the request for review from a team May 5, 2025 13:24
@bmarty bmarty added the PR-Bugfix For bug fix label May 5, 2025
@bmarty bmarty requested a review from jmartinesp May 5, 2025 13:24
@bmarty bmarty changed the title Feature/bma/fix read receipt Fix read receipt behavior when the timeline is opened. May 5, 2025
Copy link
Contributor

github-actions bot commented May 5, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/nvywig

Comment on lines +282 to +285
val newMostRecentItem = timelineItems.firstOrNull {
// Ignore typing item
(it as? TimelineItem.Virtual)?.model !is TimelineItemTypingNotificationModel
}
Copy link
Member

Choose a reason for hiding this comment

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

Oh, good catch 👌 .

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I could also have dropped the first item, but I guess it's more accurate like this.

@bmarty
Copy link
Member Author

bmarty commented May 6, 2025

@jmartinesp I have updated the fix to fix regression on tests.

I have tested again and the fix is still working (there is no tests covering the use case). Can you have a second look please? Thanks!

Copy link

codecov bot commented May 6, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 80.11%. Comparing base (0976c7f) to head (522aea3).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...id/features/messages/impl/timeline/TimelineView.kt 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4679      +/-   ##
===========================================
- Coverage    80.11%   80.11%   -0.01%     
===========================================
  Files         2124     2124              
  Lines        56254    56256       +2     
  Branches      7012     7014       +2     
===========================================
  Hits         45068    45068              
- Misses        8776     8777       +1     
- Partials      2410     2411       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -286,19 +286,19 @@ private fun BoxScope.TimelineScrollHelper(
}
var jumpToLiveHandled by remember { mutableStateOf(true) }

fun scrollToBottom() {
fun scrollToBottom(force: Boolean) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment for why the force param is needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bmarty bmarty enabled auto-merge (squash) May 6, 2025 12:13
Copy link

sonarqubecloud bot commented May 6, 2025

@bmarty bmarty merged commit 3603ed6 into develop May 6, 2025
29 checks passed
@bmarty bmarty deleted the feature/bma/fixReadReceipt branch May 6, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Seen" status only populate when target user exit and re-enter room not if they are already in the room
2 participants