Fixed contacts from remote LDAP/CardDAV not shown in contacts list when doing a search

This commit is contained in:
Sylvain Berfini 2024-12-20 11:12:59 +01:00
parent 8f52182959
commit 83f249b1d9
2 changed files with 5 additions and 4 deletions

View file

@ -524,9 +524,10 @@ class ContactsManager
}
@WorkerThread
fun isContactTemporary(friend: Friend): Boolean {
fun isContactTemporary(friend: Friend, allowNullFriendList: Boolean = false): Boolean {
val friendList = friend.friendList
return friendList == null || friendList.displayName == FRIEND_LIST_TEMPORARY_STORED_NATIVE || friendList.displayName == FRIEND_LIST_TEMPORARY_STORED_REMOTE_DIRECTORY
if (friendList == null && !allowNullFriendList) return true
return friendList?.displayName == FRIEND_LIST_TEMPORARY_STORED_NATIVE || friendList?.displayName == FRIEND_LIST_TEMPORARY_STORED_REMOTE_DIRECTORY
}
@WorkerThread

View file

@ -287,7 +287,7 @@ class ContactsListViewModel
for (result in results) {
val friend = result.friend
if (friend != null) {
if (coreContext.contactsManager.isContactTemporary(friend)) continue
if (coreContext.contactsManager.isContactTemporary(friend, allowNullFriendList = true)) continue
if (friend.refKey.orEmpty().isEmpty()) {
if (friend.vcard != null) {
@ -333,7 +333,7 @@ class ContactsListViewModel
favourites.postValue(favouritesList)
contactsList.postValue(list)
Log.i("$TAG Processed [${results.size}] results")
Log.i("$TAG Processed [${results.size}] results into [${list.size} contacts]")
firstLoad = false
}
}