Avoid deleting sent messages on non room events

This commit is contained in:
ariskotsomitopoulos 2022-01-17 12:13:01 +02:00
parent f025554612
commit 3656896af9
1 changed files with 3 additions and 0 deletions

View File

@ -514,6 +514,9 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
* we clear all SENT events, and we are sure that we will receive it from /sync or pagination * we clear all SENT events, and we are sure that we will receive it from /sync or pagination
*/ */
private fun fixStuckLocalEcho(rooms: List<RoomEntity>) { private fun fixStuckLocalEcho(rooms: List<RoomEntity>) {
// when there are not room events, there is no need to delete SENT messages
// this might be useful for events like typing etc
if(rooms.isNullOrEmpty()) return
rooms.forEach { roomEntity -> rooms.forEach { roomEntity ->
roomEntity.sendingTimelineEvents.filter { timelineEvent -> roomEntity.sendingTimelineEvents.filter { timelineEvent ->
timelineEvent.root?.sendState == SendState.SENT timelineEvent.root?.sendState == SendState.SENT