1
0
Fork 0

Merge pull request #11149 from nupplaphil/bug/friendica-11144

Add missing Twitter API routes for IDs
This commit is contained in:
Michael Vogel 2022-01-09 00:00:07 +01:00 committed by GitHub
commit 5b8f78f728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -21,7 +21,6 @@
namespace Friendica\Module\Api\Twitter\Statuses;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\DI;
@ -45,10 +44,12 @@ class Retweet extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
$id = $request['id'] ?? 0;
if (empty($id)) {
throw new BadRequestException('Item id not specified');
if (!empty($this->parameters['id'])) {
$id = (int)$this->parameters['id'];
} elseif (!empty($request['id'])) {
$id = (int)$request['id'];
} else {
throw new BadRequestException('An id is missing.');
}
$fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];

View file

@ -120,6 +120,7 @@ $apiRoutes = [
'/statuses' => [
'/destroy[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Destroy::class, [ R::POST]],
'/destroy/{id:\d+}[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Destroy::class, [ R::POST]],
'/followers[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Followers\Lists::class, [R::GET ]],
'/friends[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Friends\Lists::class, [R::GET ]],
'/friends_timeline[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\HomeTimeline::class, [R::GET ]],
@ -131,6 +132,7 @@ $apiRoutes = [
'/public_timeline[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\PublicTimeline::class, [R::GET ]],
'/replies[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Mentions::class, [R::GET ]],
'/retweet[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Retweet::class, [ R::POST]],
'/retweet/{id:\d+}[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Retweet::class, [ R::POST]],
'/show[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Show::class, [R::GET ]],
'/show/{id:\d+}[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Show::class, [R::GET ]],
'/update[.{extension:json|xml|rss|atom}]' => [Module\Api\Twitter\Statuses\Update::class, [ R::POST]],