[twitter] Fix return value of twitter_user_to_contact()

- Simplify check in twitter_fetch_own_contact()
pull/991/head
Hypolite Petovan 2020-06-21 16:33:18 -04:00
parent b07e4bd59c
commit ef21c83037
1 changed files with 6 additions and 2 deletions

View File

@ -1079,10 +1079,14 @@ function twitter_get_relation($uid, $target, $contact = [])
return $relation; return $relation;
} }
/**
* @param $data
* @return array
*/
function twitter_user_to_contact($data) function twitter_user_to_contact($data)
{ {
if (empty($data->id_str)) { if (empty($data->id_str)) {
return -1; return [];
} }
$baseurl = 'https://twitter.com'; $baseurl = 'https://twitter.com';
@ -1924,7 +1928,7 @@ function twitter_fetch_own_contact(App $a, $uid)
// Fetching user data // Fetching user data
// get() may throw TwitterOAuthException, but we will catch it later // get() may throw TwitterOAuthException, but we will catch it later
$user = $connection->get('account/verify_credentials'); $user = $connection->get('account/verify_credentials');
if (empty($user) || empty($user->id_str)) { if (empty($user->id_str)) {
return false; return false;
} }