Merge pull request #4126 from annando/issue-4121

Fix for issue 4121 - now the description isn't empty
This commit is contained in:
Hypolite Petovan 2017-12-24 21:19:21 -05:00 committed by GitHub
commit c6a00f5ac4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -743,13 +743,27 @@ function api_get_user(App $a, $contact_id = null)
$pcontact_id = Contact::getIdForURL($uinfo[0]['url'], 0, true); $pcontact_id = Contact::getIdForURL($uinfo[0]['url'], 0, true);
if (!empty($profile[0]['pdesc'])) {
$description = $profile[0]['pdesc'];
} else {
$description = $uinfo[0]["about"];
}
if (!empty($usr[0]['default-location'])) {
$location = $usr[0]['default-location'];
} elseif (!empty($uinfo[0]["location"])) {
$location = $uinfo[0]["location"];
} else {
$location = $network_name;
}
$ret = array( $ret = array(
'id' => intval($pcontact_id), 'id' => intval($pcontact_id),
'id_str' => (string) intval($pcontact_id), 'id_str' => (string) intval($pcontact_id),
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']), 'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']), 'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
'location' => ($usr) ? $usr[0]['default-location'] : $network_name, 'location' => $location,
'description' => (($profile) ? $profile[0]['pdesc'] : null), 'description' => $description,
'profile_image_url' => $uinfo[0]['micro'], 'profile_image_url' => $uinfo[0]['micro'],
'profile_image_url_https' => $uinfo[0]['micro'], 'profile_image_url_https' => $uinfo[0]['micro'],
'url' => $uinfo[0]['url'], 'url' => $uinfo[0]['url'],