Set different permissions for comments via API

This commit is contained in:
Michael 2023-03-24 20:39:11 +00:00
parent 08d1e484e3
commit 8a55ce2415
3 changed files with 10 additions and 9 deletions

View file

@ -266,15 +266,14 @@ class Statuses extends BaseApi
}
if ($request['in_reply_to_id']) {
$parent = Post::selectFirst(['uri', 'private'], ['uri-id' => $request['in_reply_to_id'], 'uid' => [0, $uid]]);
$parent = Post::selectFirst(['uri'], ['uri-id' => $request['in_reply_to_id'], 'uid' => [0, $uid]]);
if (empty($parent)) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $request['in_reply_to_id'] . ' not found for user ' . $uid . '.');
}
$item['thr-parent'] = $parent['uri'];
$item['gravity'] = Item::GRAVITY_COMMENT;
$item['object-type'] = Activity\ObjectType::COMMENT;
if (in_array($parent['private'], [Item::UNLISTED, Item::PUBLIC]) && ($item['private'] == Item::PRIVATE)) {
throw new HTTPException\NotImplementedException('Private replies for public posts are not implemented.');
}
} else {
self::checkThrottleLimit();