Use correct function to fetch the self user

This commit is contained in:
Michael 2021-11-21 00:26:35 +00:00
parent ae99144f57
commit 2c6afe65a7
3 changed files with 10 additions and 17 deletions

View file

@ -986,7 +986,7 @@ function api_statuses_home_timeline($type)
} }
} }
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
@ -1057,7 +1057,7 @@ function api_statuses_public_timeline($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -1105,7 +1105,7 @@ function api_statuses_networkpublic_timeline($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -1452,7 +1452,7 @@ function api_statuses_mentions($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -1516,7 +1516,7 @@ function api_statuses_user_timeline($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -1583,7 +1583,7 @@ function api_favorites_create_destroy($type)
$ret = api_format_item($item, $type); $ret = api_format_item($item, $type);
return DI::apiResponse()->formatData("status", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("status", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -1637,7 +1637,7 @@ function api_favorites($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -2417,7 +2417,7 @@ function api_lists_statuses($type)
} }
DBA::close($statuses); DBA::close($statuses);
return DI::apiResponse()->formatData("statuses", $type, ['status' => $items], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("statuses", $type, ['status' => $items], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -2653,7 +2653,7 @@ function api_direct_messages_new($type)
$ret = ["error" => $id]; $ret = ["error" => $id];
} }
return DI::apiResponse()->formatData("direct-messages", $type, ['direct_message' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("direct-messages", $type, ['direct_message' => $ret], Contact::getPublicIdByUserId($uid));
} }
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
@ -2896,7 +2896,7 @@ function api_direct_messages_box($type, $box, $verbose)
} }
} }
return DI::apiResponse()->formatData("direct-messages", $type, ['direct_message' => $ret], Contact::createSelfFromUserId($uid)); return DI::apiResponse()->formatData("direct-messages", $type, ['direct_message' => $ret], Contact::getPublicIdByUserId($uid));
} }
/** /**

View file

@ -48,10 +48,6 @@ class User extends BaseFactory
$userContact = []; $userContact = [];
} }
if (empty($publicContact)) {
return null;
}
$apcontact = APContact::getByURL($publicContact['url'], false); $apcontact = APContact::getByURL($publicContact['url'], false);
return new \Friendica\Object\Api\Twitter\User($publicContact, $apcontact, $userContact, $skip_status, $include_user_entities); return new \Friendica\Object\Api\Twitter\User($publicContact, $apcontact, $userContact, $skip_status, $include_user_entities);

View file

@ -329,9 +329,6 @@ class BaseApi extends BaseModule
} }
$user_info = DI::twitterUser()->createFromContactId($cid)->toArray(); $user_info = DI::twitterUser()->createFromContactId($cid)->toArray();
if (empty($user_info)) {
return $arr;
}
$arr['$user'] = $user_info; $arr['$user'] = $user_info;
$arr['$rss'] = [ $arr['$rss'] = [