mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update status api, autolink caption before returning response
This commit is contained in:
parent
a994ec7be7
commit
b00a453b99
1 changed files with 8 additions and 3 deletions
|
@ -2064,11 +2064,15 @@ class ApiV1Controller extends Controller
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = strip_tags($request->input('status'));
|
||||||
|
$rendered = Autolink::create()->autolink($content);
|
||||||
|
|
||||||
if($in_reply_to_id) {
|
if($in_reply_to_id) {
|
||||||
$parent = Status::findOrFail($in_reply_to_id);
|
$parent = Status::findOrFail($in_reply_to_id);
|
||||||
|
|
||||||
$status = new Status;
|
$status = new Status;
|
||||||
$status->caption = strip_tags($request->input('status'));
|
$status->caption = $content;
|
||||||
|
$status->rendered = $rendered;
|
||||||
$status->scope = $visibility;
|
$status->scope = $visibility;
|
||||||
$status->visibility = $visibility;
|
$status->visibility = $visibility;
|
||||||
$status->profile_id = $user->profile_id;
|
$status->profile_id = $user->profile_id;
|
||||||
|
@ -2090,7 +2094,8 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
if(!$in_reply_to_id) {
|
if(!$in_reply_to_id) {
|
||||||
$status = new Status;
|
$status = new Status;
|
||||||
$status->caption = strip_tags($request->input('status'));
|
$status->caption = $content;
|
||||||
|
$status->rendered = $rendered;
|
||||||
$status->profile_id = $user->profile_id;
|
$status->profile_id = $user->profile_id;
|
||||||
$status->scope = 'draft';
|
$status->scope = 'draft';
|
||||||
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false);
|
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false);
|
||||||
|
@ -2479,7 +2484,7 @@ class ApiV1Controller extends Controller
|
||||||
$pid = $request->user()->profile_id;
|
$pid = $request->user()->profile_id;
|
||||||
$status = StatusService::get($id);
|
$status = StatusService::get($id);
|
||||||
|
|
||||||
abort_if(!in_array($status['visibility'], ['public', 'unlisted']), 404);
|
abort_if(!$status || !in_array($status['visibility'], ['public', 'unlisted']), 404);
|
||||||
|
|
||||||
$sortBy = $request->input('sort', 'all');
|
$sortBy = $request->input('sort', 'all');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue