diff --git a/changelog.d/5514.bugfix b/changelog.d/5514.bugfix new file mode 100644 index 0000000000..0dfbca6e9a --- /dev/null +++ b/changelog.d/5514.bugfix @@ -0,0 +1 @@ +Read receipt in wrong order \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt index e66dd4b043..502f17e78b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt @@ -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() - + }.toList() + val readReceiptsDataSorted = sortItem(readReceiptsData) return ReadReceiptsItem_() .id("read_receipts_$eventId") .eventId(eventId) - .readReceipts(readReceiptsData) + .readReceipts(readReceiptsDataSorted) .avatarRenderer(avatarRenderer) .shouldHideReadReceipts(isFromThreadTimeLine) .clickListener { - callback?.onReadReceiptsClicked(readReceiptsData) + callback?.onReadReceiptsClicked(readReceiptsDataSorted) } } + + fun sortItem(readReceipt: List): List { + return readReceipt.sortedByDescending { + it.timestamp + } + } }