1
1
Fork 0

Contact details are now available when searching for a single contact

This commit is contained in:
Michael 2019-09-02 05:33:13 +00:00
parent 3ee26ecd24
commit 8947473c71

View file

@ -44,15 +44,19 @@ class Search extends BaseObject
if ((filter_var($user, FILTER_VALIDATE_EMAIL) && Network::isEmailDomainValid($user)) || if ((filter_var($user, FILTER_VALIDATE_EMAIL) && Network::isEmailDomainValid($user)) ||
(substr(Strings::normaliseLink($user), 0, 7) == "http://")) { (substr(Strings::normaliseLink($user), 0, 7) == "http://")) {
/// @todo Possibly use "getIdForURL" instead?
$user_data = Probe::uri($user); $user_data = Probe::uri($user);
if (empty($user_data)) { if (empty($user_data)) {
return $emptyResultList; return $emptyResultList;
} }
if (!(in_array($user_data["network"], Protocol::FEDERATED))) { if (!in_array($user_data["network"], Protocol::FEDERATED)) {
return $emptyResultList; return $emptyResultList;
} }
// Ensure that we do have a contact entry
Contact::getIdForURL(defaults($user_data, 'url', ''));
$contactDetails = Contact::getDetailsByURL(defaults($user_data, 'url', ''), local_user()); $contactDetails = Contact::getDetailsByURL(defaults($user_data, 'url', ''), local_user());
$itemUrl = defaults($contactDetails, 'addr', defaults($user_data, 'url', '')); $itemUrl = defaults($contactDetails, 'addr', defaults($user_data, 'url', ''));
@ -63,7 +67,7 @@ class Search extends BaseObject
defaults($user_data, 'url', ''), defaults($user_data, 'url', ''),
defaults($user_data, 'photo', ''), defaults($user_data, 'photo', ''),
defaults($user_data, 'network', ''), defaults($user_data, 'network', ''),
defaults($contactDetails, 'cid', 0), defaults($contactDetails, 'id', 0),
0, 0,
defaults($user_data, 'tags', '') defaults($user_data, 'tags', '')
); );