mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update ProfileController
This commit is contained in:
parent
a4a1270e70
commit
1c59933c0a
2 changed files with 7 additions and 6 deletions
|
@ -14,7 +14,7 @@ class PollController extends Controller
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
abort_if(!config_cache('exp.polls'), 404);
|
abort_if(!config_cache('instance.polls.enabled'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPoll(Request $request, $id)
|
public function getPoll(Request $request, $id)
|
||||||
|
|
|
@ -13,6 +13,7 @@ use App\Story;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\UserFilter;
|
use App\UserFilter;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
use App\Services\FollowerService;
|
||||||
use App\Util\Lexer\Nickname;
|
use App\Util\Lexer\Nickname;
|
||||||
use App\Util\Webfinger\Webfinger;
|
use App\Util\Webfinger\Webfinger;
|
||||||
use App\Transformer\ActivityPub\ProfileOutbox;
|
use App\Transformer\ActivityPub\ProfileOutbox;
|
||||||
|
@ -238,12 +239,12 @@ class ProfileController extends Controller
|
||||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||||
$pid = $profile->id;
|
$pid = $profile->id;
|
||||||
$authed = Auth::user()->profile;
|
$authed = Auth::user()->profile_id;
|
||||||
abort_if($pid != $authed->id && $profile->followedBy($authed) == false, 404);
|
abort_if($pid != $authed && !FollowerService::follows($authed, $pid), 404);
|
||||||
$exists = Story::whereProfileId($pid)
|
$exists = Story::whereProfileId($pid)
|
||||||
->where('expires_at', '>', now())
|
->whereActive(true)
|
||||||
->count();
|
->exists();
|
||||||
abort_unless($exists > 0, 404);
|
abort_unless($exists, 404);
|
||||||
return view('profile.story', compact('pid', 'profile'));
|
return view('profile.story', compact('pid', 'profile'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue