diff --git a/app/Services/BookmarkService.php b/app/Services/BookmarkService.php new file mode 100644 index 000000000..0e2b8465e --- /dev/null +++ b/app/Services/BookmarkService.php @@ -0,0 +1,16 @@ +whereStatusId($statusId)->exists(); + // }); + } +} diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php index 13d62b473..d9cbeaa65 100644 --- a/app/Transformer/Api/StatusTransformer.php +++ b/app/Transformer/Api/StatusTransformer.php @@ -17,13 +17,15 @@ use App\Services\ProfileService; use Illuminate\Support\Str; use App\Services\PollService; use App\Models\CustomEmoji; +use App\Services\BookmarkService; class StatusTransformer extends Fractal\TransformerAbstract { public function transform(Status $status) { + $pid = request()->user()->profile_id; $taggedPeople = MediaTagService::get($status->id); - $poll = $status->type === 'poll' ? PollService::get($status->id, request()->user()->profile_id) : null; + $poll = $status->type === 'poll' ? PollService::get($status->id, $pid) : null; return [ '_v' => 1, @@ -69,6 +71,7 @@ class StatusTransformer extends Fractal\TransformerAbstract 'account' => ProfileService::get($status->profile_id), 'tags' => StatusHashtagService::statusTags($status->id), 'poll' => $poll, + 'bookmarked' => BookmarkService::get($pid, $status->id), ]; } }