Fix rendered caption

This commit is contained in:
Daniel Supernault 2025-01-03 21:53:35 -07:00
parent 1af73c55fb
commit 85124aa642
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
5 changed files with 5 additions and 7 deletions

View file

@ -3494,7 +3494,7 @@ class ApiV1Controller extends Controller
return []; return [];
} }
$defaultCaption = config_cache('database.default') === 'mysql' ? null : ""; $defaultCaption = "";
$content = $request->filled('status') ? strip_tags($request->input('status')) : $defaultCaption; $content = $request->filled('status') ? strip_tags($request->input('status')) : $defaultCaption;
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false); $cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null; $spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;

View file

@ -1292,7 +1292,7 @@ class ApiV1Dot1Controller extends Controller
if ($user->last_active_at == null) { if ($user->last_active_at == null) {
return []; return [];
} }
$defaultCaption = config_cache('database.default') === 'mysql' ? null : ""; $defaultCaption = "";
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption; $content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption;
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false); $cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null; $spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;

View file

@ -55,14 +55,12 @@ class CommentController extends Controller
} }
$reply = DB::transaction(function () use ($comment, $status, $profile, $nsfw) { $reply = DB::transaction(function () use ($comment, $status, $profile, $nsfw) {
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
$scope = $profile->is_private == true ? 'private' : 'public'; $scope = $profile->is_private == true ? 'private' : 'public';
$reply = new Status; $reply = new Status;
$reply->profile_id = $profile->id; $reply->profile_id = $profile->id;
$reply->is_nsfw = $nsfw; $reply->is_nsfw = $nsfw;
$reply->caption = Purify::clean($comment); $reply->caption = Purify::clean($comment);
$reply->rendered = $defaultCaption; $reply->rendered = "";
$reply->in_reply_to_id = $status->id; $reply->in_reply_to_id = $status->id;
$reply->in_reply_to_profile_id = $status->profile_id; $reply->in_reply_to_profile_id = $status->profile_id;
$reply->scope = $scope; $reply->scope = $scope;

View file

@ -570,7 +570,7 @@ class ComposeController extends Controller
$status->cw_summary = $request->input('spoiler_text'); $status->cw_summary = $request->input('spoiler_text');
} }
$defaultCaption = config_cache('database.default') === 'mysql' ? null : ""; $defaultCaption = "";
$status->caption = strip_tags($request->input('caption')) ?? $defaultCaption; $status->caption = strip_tags($request->input('caption')) ?? $defaultCaption;
$status->rendered = $defaultCaption; $status->rendered = $defaultCaption;
$status->scope = 'draft'; $status->scope = 'draft';

View file

@ -689,7 +689,7 @@ class Helpers
return $option['replies']['totalItems'] ?? 0; return $option['replies']['totalItems'] ?? 0;
})->toArray(); })->toArray();
$defaultCaption = config_cache('database.default') === 'mysql' ? null : ""; $defaultCaption = "";
$status = new Status; $status = new Status;
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$status->url = isset($res['url']) ? $res['url'] : $url; $status->url = isset($res['url']) ? $res['url'] : $url;