Making tests possibly happy

This commit is contained in:
Michael 2021-11-18 06:31:02 +00:00
parent 03810f3e31
commit d0bae37538

View File

@ -498,14 +498,20 @@ function api_get_user($contact_id = null)
*/ */
function api_item_get_user(App $a, $item) function api_item_get_user(App $a, $item)
{ {
$status_user = DI::twitterUser()->createFromContactId($item['author-id'] ?? 0, BaseApi::getCurrentUserID())->toArray(); if (empty($item['author-id'])) {
$item['author-id'] = Contact::getPublicIdByUserId(BaseApi::getCurrentUserID());
}
$status_user = DI::twitterUser()->createFromContactId($item['author-id'], BaseApi::getCurrentUserID())->toArray();
$author_user = $status_user; $author_user = $status_user;
$status_user["protected"] = isset($item['private']) && ($item['private'] == Item::PRIVATE); $status_user["protected"] = isset($item['private']) && ($item['private'] == Item::PRIVATE);
if (($item['thr-parent'] ?? '') == ($item['uri'] ?? '')) { if (($item['thr-parent'] ?? '') == ($item['uri'] ?? '')) {
$owner_user = DI::twitterUser()->createFromContactId($item['owner-id'] ?? 0, BaseApi::getCurrentUserID())->toArray(); if (empty($item['owner-id'])) {
$item['owner-id'] = Contact::getPublicIdByUserId(BaseApi::getCurrentUserID());
}
$owner_user = DI::twitterUser()->createFromContactId($item['owner-id'], BaseApi::getCurrentUserID())->toArray();
} else { } else {
$owner_user = $author_user; $owner_user = $author_user;
} }