1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-24 08:44:02 +00:00

Update StoryController

This commit is contained in:
Daniel Supernault 2020-01-10 22:03:51 -07:00
parent 71f6cbb5a6
commit aba509fc6b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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)