Don't ask for empty bodies

This commit is contained in:
Michael 2021-01-17 21:03:35 +00:00
parent 5a36c6b6c0
commit cd070954da

View file

@ -2043,7 +2043,7 @@ function api_statuses_repeat($type)
$fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink']; $fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
$item = Post::selectFirst($fields, ['id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED]]); $item = Post::selectFirst($fields, ['id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
if (!empty($item['body'])) { if (DBA::isResult($item)) {
if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::TWITTER])) { if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::TWITTER])) {
if (!Item::performActivity($id, 'announce', local_user())) { if (!Item::performActivity($id, 'announce', local_user())) {
throw new InternalServerErrorException(); throw new InternalServerErrorException();
@ -2075,7 +2075,7 @@ function api_statuses_repeat($type)
$item_id = item_post($a); $item_id = item_post($a);
} }
} else { } else {
throw new ForbiddenException(!DBA::isResult($item) ? 'not found' : 'empty body'); throw new ForbiddenException();
} }
// output the post that we just posted. // output the post that we just posted.