mirror of
https://github.com/friendica/friendica
synced 2024-12-23 08:00:16 +00:00
Convert Directory Search results into contact-looking records
- Address https://github.com/friendica/friendica/issues/12488#issuecomment-1368216631
This commit is contained in:
parent
6e06a7f14c
commit
f9676c9ed2
1 changed files with 18 additions and 1 deletions
|
@ -233,7 +233,24 @@ class Search
|
|||
if ($curlResult->isSuccess()) {
|
||||
$searchResult = json_decode($curlResult->getBody(), true);
|
||||
if (!empty($searchResult['profiles'])) {
|
||||
$return = $searchResult['profiles'];
|
||||
// Converting Directory Search results into contact-looking records
|
||||
$return = array_map(function ($result) {
|
||||
static $contactType = [
|
||||
'People' => Contact::TYPE_PERSON,
|
||||
'Forum' => Contact::TYPE_COMMUNITY,
|
||||
'Organization' => Contact::TYPE_ORGANISATION,
|
||||
'News' => Contact::TYPE_NEWS,
|
||||
];
|
||||
|
||||
return [
|
||||
'name' => $result['name'],
|
||||
'addr' => $result['addr'],
|
||||
'url' => $result['profile_url'],
|
||||
'network' => Protocol::DFRN,
|
||||
'micro' => $result['photo'],
|
||||
'contact-type' => $contactType[$result['account_type']],
|
||||
];
|
||||
}, $searchResult['profiles']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue