-
Notifications
You must be signed in to change notification settings - Fork 782
Read receipt in wrong order #5532
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
Conversation
Unit Test Results 98 files ± 0 98 suites ±0 1m 9s ⏱️ -5s Results for commit 6c7b4d4. ± Comparison against base commit acfeb7f. This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
.toList() | ||
|
||
}.toList() | ||
val readReceiptsDataSorted = sortItem(readReceiptsData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we know why this extra sorting is needed? it looks like we're already sorting by originServerTs
https://github.com./vector-im/element-android/blob/develop/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/TimelineEventMapper.kt#L53 (assuming this mapper is used)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's necessary when we have to concatenate the read receipts which come from different events (not displayed by default in android application but displayed in web application). The complete list is not ordered but each small list is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for the explanation
@@ -37,17 +37,22 @@ class ReadReceiptsItemFactory @Inject constructor(private val avatarRenderer: Av | |||
val readReceiptsData = readReceipts | |||
.map { | |||
ReadReceiptData(it.roomMember.userId, it.roomMember.avatarUrl, it.roomMember.displayName, it.originServerTs) | |||
} | |||
.toList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can avoid the extra function by applying the sorting here
.map { ... }
.sortedByDescending { it.timestamp }
also looks like the toList
isn't needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you're right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is OK, but I think the sorting should be rather done SDK side.
Type of change
Content
Update read receipt order in the factory.
Motivation and context
#5514
Screenshots / GIFs
Tests
Open ready receipt details on a message (especially if there is some events hidden before it)
Tested devices
Checklist