From 615192fae0e04055b3d4de0ba305163c546046b1 Mon Sep 17 00:00:00 2001
From: Paul Mehrer
Date: Wed, 26 Feb 2025 10:20:35 +0100
Subject: [PATCH] tweak(Adb) list controller get/removeHiddenMembers
optimazation
---
tine20/Addressbook/Controller/Contact.php | 3 ++-
tine20/Addressbook/Controller/List.php | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tine20/Addressbook/Controller/Contact.php b/tine20/Addressbook/Controller/Contact.php
index 237abe563b2..f07665965a8 100644
--- a/tine20/Addressbook/Controller/Contact.php
+++ b/tine20/Addressbook/Controller/Contact.php
@@ -113,7 +113,8 @@ public function get($_id, $_containerId = NULL, $_getRelatedData = TRUE, $_getDe
if ($_id) {
$listController = Addressbook_Controller_List::getInstance();
$groups = $listController->getMemberships($_id);
- $contact->groups = $listController->search(Tinebase_Model_Filter_FilterGroup::getFilterForModel(Addressbook_Model_List::class, [
+ // we remove the list members, so we can do the search on the backend, its way more efficient
+ $contact->groups = $listController->getBackend()->search(Tinebase_Model_Filter_FilterGroup::getFilterForModel(Addressbook_Model_List::class, [
['field' => 'id', 'operator' => 'in', 'value' => $groups]
]));
$contact->groups->members = null;
diff --git a/tine20/Addressbook/Controller/List.php b/tine20/Addressbook/Controller/List.php
index 17751afadd8..d60b809a650 100644
--- a/tine20/Addressbook/Controller/List.php
+++ b/tine20/Addressbook/Controller/List.php
@@ -193,7 +193,7 @@ public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tineba
{
$result = parent::search($_filter, $_pagination, $_getRelations, $_onlyIds, $_action);
- if ($_onlyIds !== true) {
+ if ($result instanceof Tinebase_Record_RecordSet) {
$this->_removeHiddenListMembers($result);
}