Function renamed, documentation added

This commit is contained in:
Michael 2021-07-30 10:24:08 +00:00
parent aac965be7d
commit 93263a820d
4 changed files with 9 additions and 5 deletions

View file

@ -45,7 +45,7 @@ class ScheduledStatus extends BaseFactory
* @return \Friendica\Object\Api\Mastodon\ScheduledStatus
* @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]);
if (empty($delayed_post)) {
@ -53,6 +53,9 @@ class ScheduledStatus extends BaseFactory
}
$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);
}

View file

@ -72,7 +72,7 @@ class ScheduledStatuses extends BaseApi
$uid = self::getCurrentUserID();
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([
@ -104,7 +104,7 @@ class ScheduledStatuses extends BaseApi
$statuses = [];
while ($post = DBA::fetch($posts)) {
self::setBoundaries($post['id']);
$statuses[] = DI::mstdnScheduledStatus()->createFromId($post['id'], $uid);
$statuses[] = DI::mstdnScheduledStatus()->createFromDelayedPostId($post['id'], $uid);
}
DBA::close($posts);

View file

@ -190,7 +190,7 @@ class Statuses extends BaseApi
if (empty($id)) {
DI::mstdnError()->InternalError();
}
System::jsonExit(DI::mstdnScheduledStatus()->createFromId($id, $uid)->toArray());
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
}
$id = Item::insert($item, true);

View file

@ -55,7 +55,8 @@ class ScheduledStatus extends BaseDataTransferObject
/**
* 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
*/
public function __construct(array $delayed_post, array $parameters)