diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.kt index c9d276201..f02eeff40 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.kt @@ -131,10 +131,12 @@ class OfflineFirstConversationsRepository @Inject constructor( } private suspend fun deleteLeftConversations(conversationsFromSync: List) { + val conversationsFromSyncIds = conversationsFromSync.map { it.internalId }.toSet() val oldConversationsFromDb = dao.getConversationsForUser(user.id!!).first() - val conversationsToDelete = oldConversationsFromDb.filterNot { conversationsFromSync.contains(it) } - val conversationIdsToDelete = conversationsToDelete.map { it.internalId } + val conversationIdsToDelete = oldConversationsFromDb + .map { it.internalId } + .filterNot { it in conversationsFromSyncIds } dao.deleteConversations(conversationIdsToDelete) }