From bbc56b74da637029893aae7ee05f9323d256ac0e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 8 Nov 2018 22:29:57 -0700 Subject: [PATCH] Update StatusController --- app/Http/Controllers/StatusController.php | 30 +---------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index fb5682cb9..c8a49dc48 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -23,7 +23,6 @@ class StatusController extends Controller $status = Status::whereProfileId($user->id) ->where('visibility', '!=', 'draft') - ->withCount(['likes', 'comments', 'media']) ->findOrFail($id); if($status->visibility == 'private' || $user->is_private) { @@ -40,34 +39,7 @@ class StatusController extends Controller return $this->showActivityPub($request, $status); } - $template = $this->detectTemplate($status); - - $replies = Status::whereInReplyToId($status->id)->orderBy('created_at', 'desc')->simplePaginate(30); - - return view($template, compact('user', 'status', 'replies')); - } - - protected function detectTemplate($status) - { - $template = Cache::rememberForever('template:status:type:'.$status->id, function () use ($status) { - $template = 'status.show.photo'; - if (!$status->media_path && $status->in_reply_to_id) { - $template = 'status.reply'; - } - if ($status->media->count() > 1) { - $template = 'status.show.album'; - } - if ($status->viewType() == 'video') { - $template = 'status.show.video'; - } - if ($status->viewType() == 'video-album') { - $template = 'status.show.video-album'; - } - - return $template; - }); - - return $template; + return view('status.show', compact('user', 'status')); } public function compose()