mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 09:04:26 +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
|
@ -21,9 +21,10 @@
|
|||
|
||||
namespace Friendica\Module\Api\Friendica;
|
||||
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
||||
/**
|
||||
* API endpoints:
|
||||
|
@ -49,7 +50,12 @@ class Activity extends BaseApi
|
|||
'id' => 0, // Id of the post
|
||||
], $request);
|
||||
|
||||
$res = Item::performActivity($request['id'], $this->parameters['verb'], $uid);
|
||||
$post = Post::selectFirst(['id'], ['uri-id' => $request['id'], 'uid' => [0, $uid]], ['order' => ['uid' => true]]);
|
||||
if (empty($post['id'])) {
|
||||
throw new BadRequestException('Item id not found');
|
||||
}
|
||||
|
||||
$res = Item::performActivity($post['id'], $this->parameters['verb'], $uid);
|
||||
|
||||
if ($res) {
|
||||
if (($this->parameters['extension'] ?? '') == 'xml') {
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace Friendica\Module\Api\Friendica\Events;
|
|||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseApi;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +39,7 @@ class Index extends BaseApi
|
|||
|
||||
$request = $this->getRequest([
|
||||
'since_id' => 0,
|
||||
'count' => 0,
|
||||
'count' => 50,
|
||||
], $request);
|
||||
|
||||
$condition = ["`id` > ? AND `uid` = ?", $request['since_id'], $uid];
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Network\HTTPException;
|
|||
*/
|
||||
class Show extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [])
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
|
|
@ -44,7 +44,7 @@ class Photo extends BaseApi
|
|||
$this->friendicaPhoto = $friendicaPhoto;
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue