*/
public function createFromUriId(int $uriId, $uid = 0): \Friendica\Object\Api\Mastodon\Status
{
- $fields = ['uri-id', 'uid', 'author-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'created', 'network',
- 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity'];
+ $fields = ['uri-id', 'uid', 'author-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning',
+ 'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity'];
$item = Post::selectFirst($fields, ['uri-id' => $uriId, 'uid' => [0, $uid]], ['order' => ['uid' => true]]);
if (!$item) {
$mail = DBA::selectFirst('mail', ['id'], ['uri-id' => $uriId, 'uid' => $uid]);
$item['verb'] = Activity::POST;
$item['contact-id'] = $owner['id'];
$item['author-id'] = $item['owner-id'] = Contact::getPublicIdByUserId($uid);
- $item['title'] = $request['spoiler_text'];
$item['body'] = $body;
if (!empty(self::getCurrentApplication()['name'])) {
if ($request['in_reply_to_id']) {
$parent = Post::selectFirst(['uri'], ['uri-id' => $request['in_reply_to_id'], 'uid' => [0, $uid]]);
+
$item['thr-parent'] = $parent['uri'];
$item['gravity'] = GRAVITY_COMMENT;
$item['object-type'] = Activity\ObjectType::COMMENT;
+ $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];
} else {
self::checkThrottleLimit();
$item['gravity'] = GRAVITY_PARENT;
$item['object-type'] = Activity\ObjectType::NOTE;
+ $item['title'] = $request['spoiler_text'];
}
$item = DI::contentItem()->expandTags($item, $request['visibility'] == 'direct');
$this->in_reply_to_account_id = (string)$item['parent-author-id'];
}
- $this->sensitive = $sensitive;
- $this->spoiler_text = $item['title'];
+ $this->sensitive = $sensitive;
+ $this->spoiler_text = $item['title'] ?: $item['content-warning'];
$visibility = ['public', 'private', 'unlisted'];
$this->visibility = $visibility[$item['private']];
$mail['title'] = '';
}
+ $mail['content-warning'] = '';
$mail['author-link'] = $mail['owner-link'] = $mail['from-url'];
$mail['owner-id'] = $mail['author-id'];
$mail['allow_cid'] = '<'.$mail['contact-id'].'>';