Skip to content

Commit

Permalink
Merge pull request #2861 from LibreSign/fix/only-return-when-have-value
Browse files Browse the repository at this point in the history
fix: only return when have value
  • Loading branch information
vitormattos authored Apr 23, 2024
2 parents b5fe837 + 0e617e9 commit 992410c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Controller/IdentifyAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function search(string $search = '', int $page = 1, int $limit = 25): Dat
[$result] = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $limit, $offset);
$result['exact'] = $this->unifyResult($result['exact']);
$result = $this->unifyResult($result);
$result = $this->excludeEmptyShareWith($result);
$return = $this->formatForNcSelect($result);
$return = $this->addHerselfAccount($return, $search);
$return = $this->addHerselfEmail($return, $search);
Expand Down Expand Up @@ -172,6 +173,12 @@ private function addHerselfEmail(array $return, string $search): array {
return $return;
}

private function excludeEmptyShareWith(array $list): array {
return array_filter($list, function ($result) {
return strlen($result['value']['shareWith']) > 0;
});
}

private function excludeNotAllowed(array $list): array {
$shareTypes = $this->getShareTypes();
return array_filter($list, function ($result) use ($shareTypes) {
Expand Down

0 comments on commit 992410c

Please sign in to comment.