mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Update StoryController
This commit is contained in:
parent
71f6cbb5a6
commit
aba509fc6b
1 changed files with 6 additions and 5 deletions
|
@ -132,14 +132,15 @@ class StoryController extends Controller
|
||||||
{
|
{
|
||||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||||
|
|
||||||
$profile = $request->user()->profile;
|
$authed = $request->user()->profile;
|
||||||
if($id == $profile->id) {
|
$profile = Profile::findOrFail($id);
|
||||||
|
if($id == $authed->id) {
|
||||||
$publicOnly = true;
|
$publicOnly = true;
|
||||||
} else {
|
} else {
|
||||||
$publicOnly = (bool) !$profile->followedBy($authed);
|
$publicOnly = (bool) $profile->followedBy($authed);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stories = Story::whereProfileId($id)
|
$stories = Story::whereProfileId($profile->id)
|
||||||
->orderBy('expires_at', 'desc')
|
->orderBy('expires_at', 'desc')
|
||||||
->where('expires_at', '>', now())
|
->where('expires_at', '>', now())
|
||||||
->when(!$publicOnly, function($query, $publicOnly) {
|
->when(!$publicOnly, function($query, $publicOnly) {
|
||||||
|
@ -172,7 +173,7 @@ class StoryController extends Controller
|
||||||
if($id == $authed->id) {
|
if($id == $authed->id) {
|
||||||
$publicOnly = true;
|
$publicOnly = true;
|
||||||
} else {
|
} else {
|
||||||
$publicOnly = (bool) !$profile->followedBy($authed);
|
$publicOnly = (bool) $profile->followedBy($authed);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stories = Story::whereProfileId($profile->id)
|
$stories = Story::whereProfileId($profile->id)
|
||||||
|
|
Loading…
Reference in a new issue