Making sure we don't delete a NTS on restore (#982)

pull/1710/head
ThomasSession 2 months ago committed by GitHub
parent 652bc64cb4
commit 13c638f00d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1332,10 +1332,10 @@ open class Storage @Inject constructor(
} }
// if we have contacts locally but that are missing from the config, remove their corresponding thread // if we have contacts locally but that are missing from the config, remove their corresponding thread
val currentUserKey = getUserPublicKey()
val removedContacts = getAllContacts().filter { localContact -> val removedContacts = getAllContacts().filter { localContact ->
moreContacts.firstOrNull { localContact.accountID != currentUserKey && // we don't want to remove ourselves (ie, our Note to Self)
it.id == localContact.accountID moreContacts.none { it.id == localContact.accountID } // we don't want to remove contacts that are present in the config
} == null
} }
removedContacts.forEach { removedContacts.forEach {
getThreadId(fromSerialized(it.accountID))?.let(::deleteConversation) getThreadId(fromSerialized(it.accountID))?.let(::deleteConversation)

Loading…
Cancel
Save