Function renamed, documentation added
This commit is contained in:
parent
aac965be7d
commit
93263a820d
|
@ -45,7 +45,7 @@ class ScheduledStatus extends BaseFactory
|
||||||
* @return \Friendica\Object\Api\Mastodon\ScheduledStatus
|
* @return \Friendica\Object\Api\Mastodon\ScheduledStatus
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function createFromId(int $id, int $uid): \Friendica\Object\Api\Mastodon\ScheduledStatus
|
public function createFromDelayedPostId(int $id, int $uid): \Friendica\Object\Api\Mastodon\ScheduledStatus
|
||||||
{
|
{
|
||||||
$delayed_post = $this->dba->selectFirst('delayed-post', [], ['id' => $id, 'uid' => $uid]);
|
$delayed_post = $this->dba->selectFirst('delayed-post', [], ['id' => $id, 'uid' => $uid]);
|
||||||
if (empty($delayed_post)) {
|
if (empty($delayed_post)) {
|
||||||
|
@ -53,6 +53,9 @@ class ScheduledStatus extends BaseFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = Post\Delayed::getParametersForid($delayed_post['id']);
|
$parameters = Post\Delayed::getParametersForid($delayed_post['id']);
|
||||||
|
if (empty($parameters)) {
|
||||||
|
throw new HTTPException\NotFoundException('Scheduled status with ID ' . $id . ' not found for user ' . $uid . '.');
|
||||||
|
}
|
||||||
|
|
||||||
return new \Friendica\Object\Api\Mastodon\ScheduledStatus($delayed_post, $parameters);
|
return new \Friendica\Object\Api\Mastodon\ScheduledStatus($delayed_post, $parameters);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class ScheduledStatuses extends BaseApi
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (isset($parameters['id'])) {
|
if (isset($parameters['id'])) {
|
||||||
System::jsonExit(DI::mstdnScheduledStatus()->createFromId($parameters['id'], $uid)->toArray());
|
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($parameters['id'], $uid)->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
@ -104,7 +104,7 @@ class ScheduledStatuses extends BaseApi
|
||||||
$statuses = [];
|
$statuses = [];
|
||||||
while ($post = DBA::fetch($posts)) {
|
while ($post = DBA::fetch($posts)) {
|
||||||
self::setBoundaries($post['id']);
|
self::setBoundaries($post['id']);
|
||||||
$statuses[] = DI::mstdnScheduledStatus()->createFromId($post['id'], $uid);
|
$statuses[] = DI::mstdnScheduledStatus()->createFromDelayedPostId($post['id'], $uid);
|
||||||
}
|
}
|
||||||
DBA::close($posts);
|
DBA::close($posts);
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ class Statuses extends BaseApi
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
DI::mstdnError()->InternalError();
|
DI::mstdnError()->InternalError();
|
||||||
}
|
}
|
||||||
System::jsonExit(DI::mstdnScheduledStatus()->createFromId($id, $uid)->toArray());
|
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = Item::insert($item, true);
|
$id = Item::insert($item, true);
|
||||||
|
|
|
@ -55,7 +55,8 @@ class ScheduledStatus extends BaseDataTransferObject
|
||||||
/**
|
/**
|
||||||
* Creates a status record from a delayed-post record.
|
* Creates a status record from a delayed-post record.
|
||||||
*
|
*
|
||||||
* @param array $delayed_post
|
* @param array $delayed_post Record with the delayed post
|
||||||
|
* @param array $parameters Parameters for the workerqueue entry for the delayed post
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $delayed_post, array $parameters)
|
public function __construct(array $delayed_post, array $parameters)
|
||||||
|
|
Loading…
Reference in a new issue