From 1c59933c0a931add244e4ad97a824a0382f7442e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 31 Aug 2021 00:35:29 -0600 Subject: [PATCH] Update ProfileController --- app/Http/Controllers/PollController.php | 2 +- app/Http/Controllers/ProfileController.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 21acd283..13d1f451 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -14,7 +14,7 @@ class PollController extends Controller public function __construct() { - abort_if(!config_cache('exp.polls'), 404); + abort_if(!config_cache('instance.polls.enabled'), 404); } public function getPoll(Request $request, $id) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 74e84f63..a3331c8d 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -13,6 +13,7 @@ use App\Story; use App\User; use App\UserFilter; use League\Fractal; +use App\Services\FollowerService; use App\Util\Lexer\Nickname; use App\Util\Webfinger\Webfinger; use App\Transformer\ActivityPub\ProfileOutbox; @@ -238,12 +239,12 @@ class ProfileController extends Controller abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404); $profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail(); $pid = $profile->id; - $authed = Auth::user()->profile; - abort_if($pid != $authed->id && $profile->followedBy($authed) == false, 404); + $authed = Auth::user()->profile_id; + abort_if($pid != $authed && !FollowerService::follows($authed, $pid), 404); $exists = Story::whereProfileId($pid) - ->where('expires_at', '>', now()) - ->count(); - abort_unless($exists > 0, 404); + ->whereActive(true) + ->exists(); + abort_unless($exists, 404); return view('profile.story', compact('pid', 'profile')); } }