Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17017313 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Don't use invalid contacts in MessagesAdapter

parent 76c4795b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ class MessagesAdapter @Inject constructor(
        if (message.isMe()) return

        val address = message.address
        if (!contactMap.containsKey(address)) {
        if (contactMap[address]?.isValid != true) {
            contactMap[address] = data?.first?.recipients?.mapNotNull { it.contact } // Map the conversation to its contacts
                    ?.firstOrNull { it.numbers.any { PhoneNumberUtils.compare(it.address, address) } } // See if any of the phone numbers match
                    ?: Contact(numbers = RealmList(PhoneNumber(address = address))) // Fallback to a fake contact