/**
* @param int $uriId Uri-ID of the item
* @param int $uid Item user
+ * @param bool $display_quote Display quoted posts
* @param bool $reblog Check for reblogged post
* @param bool $in_reply_status Add an "in_reply_status" element
- * @param bool $display_quote Display quoted posts
*
* @return \Friendica\Object\Api\Mastodon\Status
* @throws HTTPException\InternalServerErrorException
* @throws ImagickException|HTTPException\NotFoundException
*/
- public function createFromUriId(int $uriId, int $uid = 0, bool $reblog = true, bool $in_reply_status = true, bool $display_quote = false): \Friendica\Object\Api\Mastodon\Status
+ public function createFromUriId(int $uriId, int $uid = 0, bool $display_quote = false, bool $reblog = true, bool $in_reply_status = true): \Friendica\Object\Api\Mastodon\Status
{
$fields = ['uri-id', 'uid', 'author-id', 'causer-id', 'author-uri-id', 'author-link', 'causer-uri-id', 'post-reason', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id',
'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media', 'quote-uri-id'];
}
if ($is_reshare) {
- $reshare = $this->createFromUriId($uriId, $uid, false, false)->toArray();
+ $reshare = $this->createFromUriId($uriId, $uid, $display_quote, false, false)->toArray();
} else {
$reshare = [];
}
if ($in_reply_status && ($item['gravity'] == Item::GRAVITY_COMMENT)) {
- $in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, false, false)->toArray();
+ $in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, $display_quote, false, false)->toArray();
} else {
$in_reply = [];
}
}
if (!empty($quote_id)) {
- $quote = $this->createFromUriId($quote_id, $uid, false, false)->toArray();
+ $quote = $this->createFromUriId($quote_id, $uid, false, false, false)->toArray();
} else {
$quote = [];
}
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
try {
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
} catch (\Throwable $th) {
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
}
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
}
DBA::close($items);
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['thr-parent-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes);
}
DBA::close($items);
// If the user-specific search failed, we search and probe a public post
$item_id = Item::fetchByLink($q, $uid) ?: Item::fetchByLink($q);
if ($item_id && $item = Post::selectFirst(['uri-id'], ['id' => $item_id])) {
- return DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes());
+ return DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes());
}
}
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
}
DBA::close($items);
Item::update($item, ['id' => $post['id']]);
Item::updateDisplayCache($post['uri-id']);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, true, true, self::appSupportsQuotes()));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes()));
}
protected function post(array $request = [])
if (!empty($id)) {
$item = Post::selectFirst(['uri-id'], ['id' => $id]);
if (!empty($item['uri-id'])) {
- System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes()));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes()));
}
}
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, false, true, self::appSupportsQuotes()));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false));
}
private function getApp(): string
Item::update(['starred' => true], ['id' => $item['id']]);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
$display_quotes = self::appSupportsQuotes();
foreach (array_slice($ancestors, 0, $request['limit']) as $ancestor) {
- $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, true, true, $display_quotes);;
+ $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, $display_quotes);
}
$descendants = self::getChildren($id, $children);
asort($descendants);
foreach (array_slice($descendants, 0, $request['limit']) as $descendant) {
- $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, true, true, $display_quotes);
+ $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, $display_quotes);
}
System::jsonExit($statuses);
Item::performActivity($item['id'], 'like', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid,true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Post\ThreadUser::setIgnored($this->parameters['id'], $uid, true);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Post\Collection::add($this->parameters['id'], Post\Collection::FEATURED, $item['author-id'], $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Item::performActivity($item['id'], 'announce', $uid);
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Item::update(['starred' => false], ['id' => $item['id']]);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Item::performActivity($item['id'], 'unlike', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Post\ThreadUser::setIgnored($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Post\Collection::remove($this->parameters['id'], Post\Collection::FEATURED, $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
Item::performActivity($item['id'], 'unannounce', $uid);
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
}
DBA::close($items);
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
}
DBA::close($items);
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
try {
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
} catch (\Throwable $th) {
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
}
$statuses = [];
while ($item = Post::fetch($items)) {
self::setBoundaries($item['uri-id']);
- $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+ $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
}
DBA::close($items);
$trending = [];
$statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]);
while ($status = Post::fetch($statuses)) {
- $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, true, true, $display_quotes);
+ $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);
}
DBA::close($statuses);