Fix bug: readReceipt in wrong order

This commit is contained in:
Claire G 2022-03-14 10:28:42 +01:00
parent acfeb7ff65
commit 025dcc8d88
2 changed files with 11 additions and 5 deletions

1
changelog.d/5514.bugfix Normal file
View File

@ -0,0 +1 @@
Read receipt in wrong order

View File

@ -37,17 +37,22 @@ class ReadReceiptsItemFactory @Inject constructor(private val avatarRenderer: Av
val readReceiptsData = readReceipts val readReceiptsData = readReceipts
.map { .map {
ReadReceiptData(it.roomMember.userId, it.roomMember.avatarUrl, it.roomMember.displayName, it.originServerTs) ReadReceiptData(it.roomMember.userId, it.roomMember.avatarUrl, it.roomMember.displayName, it.originServerTs)
} }.toList()
.toList() val readReceiptsDataSorted = sortItem(readReceiptsData)
return ReadReceiptsItem_() return ReadReceiptsItem_()
.id("read_receipts_$eventId") .id("read_receipts_$eventId")
.eventId(eventId) .eventId(eventId)
.readReceipts(readReceiptsData) .readReceipts(readReceiptsDataSorted)
.avatarRenderer(avatarRenderer) .avatarRenderer(avatarRenderer)
.shouldHideReadReceipts(isFromThreadTimeLine) .shouldHideReadReceipts(isFromThreadTimeLine)
.clickListener { .clickListener {
callback?.onReadReceiptsClicked(readReceiptsData) callback?.onReadReceiptsClicked(readReceiptsDataSorted)
}
}
fun sortItem(readReceipt: List<ReadReceiptData>): List<ReadReceiptData> {
return readReceipt.sortedByDescending {
it.timestamp
} }
} }
} }