mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 09:54:28 +02:00
API: several fixes to the Twitter/Statusnet API
This commit is contained in:
parent
093dd70e79
commit
bf5c8a2c43
22 changed files with 94 additions and 70 deletions
|
@ -52,23 +52,18 @@ class Show extends BaseApi
|
|||
$conversation = !empty($request['conversation']);
|
||||
|
||||
// try to fetch the item for the local user - or the public item, if there is no local one
|
||||
$uri_item = Post::selectFirst(['uri-id'], ['id' => $id]);
|
||||
if (!DBA::isResult($uri_item)) {
|
||||
throw new BadRequestException(sprintf("There is no status with the id %d", $id));
|
||||
}
|
||||
|
||||
$item = Post::selectFirst(['id'], ['uri-id' => $uri_item['uri-id'], 'uid' => [0, $uid]], ['order' => ['uid' => true]]);
|
||||
$item = Post::selectFirst(['id'], ['uri-id' => $id, 'uid' => [0, $uid]], ['order' => ['uid' => true]]);
|
||||
if (!DBA::isResult($item)) {
|
||||
throw new BadRequestException(sprintf("There is no status with the uri-id %d for the given user.", $uri_item['uri-id']));
|
||||
throw new BadRequestException(sprintf("There is no status with the uri-id %d for the given user.", $id));
|
||||
}
|
||||
|
||||
$id = $item['id'];
|
||||
$item_id = $item['id'];
|
||||
|
||||
if ($conversation) {
|
||||
$condition = ['parent' => $id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||
$params = ['order' => ['id' => true]];
|
||||
$condition = ['parent' => $item_id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||
$params = ['order' => ['uri-id' => true]];
|
||||
} else {
|
||||
$condition = ['id' => $id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||
$condition = ['id' => $item_id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||
$params = [];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue