From aba509fc6b784a6f4670cb84b08309d8ece77163 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 Jan 2020 22:03:51 -0700 Subject: [PATCH] Update StoryController --- app/Http/Controllers/StoryController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/StoryController.php b/app/Http/Controllers/StoryController.php index f5d8d54b3..1884bc945 100644 --- a/app/Http/Controllers/StoryController.php +++ b/app/Http/Controllers/StoryController.php @@ -132,14 +132,15 @@ class StoryController extends Controller { abort_if(!config('instance.stories.enabled') || !$request->user(), 404); - $profile = $request->user()->profile; - if($id == $profile->id) { + $authed = $request->user()->profile; + $profile = Profile::findOrFail($id); + if($id == $authed->id) { $publicOnly = true; } else { - $publicOnly = (bool) !$profile->followedBy($authed); + $publicOnly = (bool) $profile->followedBy($authed); } - $stories = Story::whereProfileId($id) + $stories = Story::whereProfileId($profile->id) ->orderBy('expires_at', 'desc') ->where('expires_at', '>', now()) ->when(!$publicOnly, function($query, $publicOnly) { @@ -172,7 +173,7 @@ class StoryController extends Controller if($id == $authed->id) { $publicOnly = true; } else { - $publicOnly = (bool) !$profile->followedBy($authed); + $publicOnly = (bool) $profile->followedBy($authed); } $stories = Story::whereProfileId($profile->id)