// The imput is defined as text. So we can use Markdown for some enhancements
$body = Markdown::toBBCode($request['status']);
- $body = BBCode::expandTags($body);
+ // Avoids potential double expansion of existing links
+ $body = BBCode::performWithEscapedTags($body, ['url'], function ($body) {
+ return BBCode::expandTags($body);
+ });
$item = [];
$item['uid'] = $uid;
$item['deny_gid'] = $owner['deny_gid'];
} else {
$item['allow_cid'] = '';
- $item['allow_gid'] = [Group::FOLLOWERS];
+ $item['allow_gid'] = '<' . Group::FOLLOWERS . '>';
$item['deny_cid'] = '';
$item['deny_gid'] = '';
}
$item['gravity'] = GRAVITY_COMMENT;
$item['object-type'] = Activity\ObjectType::COMMENT;
} else {
+ self::checkThrottleLimit();
+
$item['gravity'] = GRAVITY_PARENT;
$item['object-type'] = Activity\ObjectType::NOTE;
}
}
}
+ if (!empty($request['scheduled_at'])) {
+ $item['guid'] = Item::guid($item, true);
+ $item['uri'] = Item::newURI($item['uid'], $item['guid']);
+ $id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
+ if (empty($id)) {
+ DI::mstdnError()->InternalError();
+ }
+ System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
+ }
+
$id = Item::insert($item, true);
if (!empty($id)) {
$item = Post::selectFirst(['uri-id'], ['id' => $id]);