mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Fix n+1 query in status view
This commit is contained in:
parent
7f7e8526f3
commit
6d5c8fb90a
2 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,9 @@ class StatusController extends Controller
|
|||
public function show(Request $request, $username, int $id)
|
||||
{
|
||||
$user = Profile::whereUsername($username)->firstOrFail();
|
||||
$status = Status::whereProfileId($user->id)->findOrFail($id);
|
||||
$status = Status::whereProfileId($user->id)
|
||||
->withCount('likes')
|
||||
->findOrFail($id);
|
||||
if(!$status->media_path && $status->in_reply_to_id) {
|
||||
return view('status.reply', compact('user', 'status'));
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="likes font-weight-bold mb-0">
|
||||
<span class="like-count">{{$status->likes()->count()}}</span> likes
|
||||
<span class="like-count">{{$status->likes_count}}</span> likes
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
|
|
Loading…
Reference in a new issue