Improved API datasets

This commit is contained in:
Michael 2021-01-17 14:57:55 +00:00
parent 0c8bb0bc18
commit d78892fc1b
2 changed files with 14 additions and 2 deletions

View file

@ -1964,12 +1964,12 @@ function api_conversation_show($type)
Logger::info(API_LOG_PREFIX . '{subaction}', ['module' => 'api', 'action' => 'conversation', 'subaction' => 'show', 'id' => $id]);
// try to fetch the item for the local user - or the public item, if there is no local one
$item = Post::selectFirst(['parent-uri'], ['id' => $id]);
$item = Post::selectFirst(['parent-uri-id'], ['id' => $id]);
if (!DBA::isResult($item)) {
throw new BadRequestException("There is no status with this id.");
}
$parent = Post::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
$parent = Post::selectFirst(['id'], ['uri-id' => $item['parent-uri-id'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
if (!DBA::isResult($parent)) {
throw new BadRequestException("There is no status with this id.");
}