diff options
Diffstat (limited to 'lib/Api')
-rw-r--r-- | lib/Api/Sharees.php | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/lib/Api/Sharees.php b/lib/Api/Sharees.php index 55df59cd..a06c7494 100644 --- a/lib/Api/Sharees.php +++ b/lib/Api/Sharees.php @@ -44,16 +44,31 @@ class Sharees { $c = self::getContainer(); $data = $c->query('CirclesService') - ->listCircles(Circle::CIRCLES_ALL, $search, Member::STATUS_MEMBER); + ->listCircles(Circle::CIRCLES_ALL, $search, Member::LEVEL_MEMBER); + + $result = array( + 'exact' => ['circles'], + 'circles' => [] + ); foreach ($data as $entry) { - $result['circles'][] = [ - 'label' => $entry->getName(), - 'value' => [ - 'shareType' => Share::SHARE_TYPE_CIRCLE, - 'shareWith' => $entry->getId() - ], - ]; + if (strtolower($entry->getName()) === strtolower($search)) { + $result['exact']['circles'][] = [ + 'label' => $entry->getName(), + 'value' => [ + 'shareType' => Share::SHARE_TYPE_CIRCLE, + 'shareWith' => $entry->getId() + ], + ]; + } else { + $result['circles'][] = [ + 'label' => $entry->getName(), + 'value' => [ + 'shareType' => Share::SHARE_TYPE_CIRCLE, + 'shareWith' => $entry->getId() + ], + ]; + } } return $result; |