]> git.mxchange.org Git - friendica.git/commitdiff
Fix for issue 4121 - now the description isn't empty
authorMichael <heluecht@pirati.ca>
Sun, 24 Dec 2017 11:51:38 +0000 (11:51 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 24 Dec 2017 11:51:38 +0000 (11:51 +0000)
include/api.php

index 9580afa86c7a1939a6a34e282fe71709f49be4a5..eb3ef796d2c1bccd61149e89ecc9eab9c2d5e51b 100644 (file)
@@ -743,13 +743,27 @@ function api_get_user(App $a, $contact_id = null)
 
        $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(
                'id' => intval($pcontact_id),
                'id_str' => (string) intval($pcontact_id),
                'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
                'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
-               'location' => ($usr) ? $usr[0]['default-location'] : $network_name,
-               'description' => (($profile) ? $profile[0]['pdesc'] : null),
+               'location' => $location,
+               'description' => $description,
                'profile_image_url' => $uinfo[0]['micro'],
                'profile_image_url_https' => $uinfo[0]['micro'],
                'url' => $uinfo[0]['url'],