Fixed LDAP/remote CardDAV results not always displayed when making a search in contacts list

This commit is contained in:
Sylvain Berfini 2025-03-27 13:22:04 +01:00
parent 317a7c4417
commit 0fab732e89
2 changed files with 10 additions and 2 deletions

View file

@ -309,7 +309,9 @@ class ContactViewModel
@WorkerThread
fun refreshContactInfo() {
isFavourite.postValue(friend.starred)
isStored.postValue(friend.inList())
// Do not show edit contact button for contacts not stored in a FriendList or
// if they are in a temporary one (for example if they are from a remote directory such as LDAP or CardDAV)
isStored.postValue(!coreContext.contactsManager.isContactTemporary(friend))
contact.value?.destroy()
contact.postValue(ContactAvatarModel(friend))

View file

@ -296,7 +296,13 @@ class ContactsListViewModel
for (result in results) {
val friend = result.friend
if (friend != null) {
if (coreContext.contactsManager.isContactTemporary(friend, allowNullFriendList = true)) continue
val isFromRemoteDirectory = result.hasSourceFlag(MagicSearch.Source.LdapServers) || result.hasSourceFlag(MagicSearch.Source.RemoteCardDAV)
// Only display friends from temporary friend lists if their source flag show they
// were fetched from a remote contact directory (and not the local friend list)
if (!isFromRemoteDirectory && coreContext.contactsManager.isContactTemporary(friend, allowNullFriendList = true)) {
Log.i("$TAG Do not show friend [${friend.name}] which is in a temporary friend list")
continue
}
if (friend.refKey.orEmpty().isEmpty()) {
if (friend.vcard != null) {