SES-2810 - Catering for missing config contacts vs local contacts

Making sure we deleted conversations when a contact is missing from the config while existing locally
This commit is contained in:
ThomasSession 2024-10-16 14:40:11 +11:00
parent bc53bcab38
commit e8b3399ee0

View File

@ -1265,6 +1265,16 @@ open class Storage(
} }
setRecipientHash(recipient, contact.hashCode().toString()) setRecipientHash(recipient, contact.hashCode().toString())
} }
// if we have contacts locally but that are missing from the config, remove their corresponding thread
val removedContacts = getAllContacts().filter { localContact ->
moreContacts.firstOrNull {
it.id == localContact.accountID
} == null
}
removedContacts.forEach {
getThreadId(fromSerialized(it.accountID))?.let(::deleteConversation)
}
} }
override fun addContacts(contacts: List<ConfigurationMessage.Contact>) { override fun addContacts(contacts: List<ConfigurationMessage.Contact>) {