From f7d3a77c9d0522cb0d0390f1d010e496e5fa69af Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Thu, 22 Jul 2021 13:02:49 -0100 Subject: [PATCH] remove root circles from search for new members Signed-off-by: Maxence Lange --- .../v2/CollaboratorSearchPlugin.php | 3 ++- lib/Model/Probes/CircleProbe.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/Collaboration/v2/CollaboratorSearchPlugin.php b/lib/Collaboration/v2/CollaboratorSearchPlugin.php index 494f0496d..256a489db 100644 --- a/lib/Collaboration/v2/CollaboratorSearchPlugin.php +++ b/lib/Collaboration/v2/CollaboratorSearchPlugin.php @@ -115,7 +115,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b ->setItemsLimit($limit) ->setItemsOffset($offset) ->setFilterCircle($filterCircle) - ->mustBeMember(!$fromFrontEnd); + ->mustBeMember(!$fromFrontEnd) + ->filterConfig(Circle::CFG_ROOT, $fromFrontEnd); $circles = $this->circleService->getCircles($probe); } catch (Exception $e) { diff --git a/lib/Model/Probes/CircleProbe.php b/lib/Model/Probes/CircleProbe.php index 8067d556c..35add02c8 100644 --- a/lib/Model/Probes/CircleProbe.php +++ b/lib/Model/Probes/CircleProbe.php @@ -214,6 +214,22 @@ public function filterBackendCircles(bool $filter = true): self { } + /** + * @param int $config + * @param bool $filter + * + * @return $this + */ + public function filterConfig(int $config, bool $filter = true): self { + $this->filter |= $config; + if (!$filter) { + $this->filter -= $config; + } + + return $this; + } + + /** * @return int */