From f86fc83cbdec89399545561a7bb7857ef3db775c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 7 Jul 2019 20:24:10 -0600 Subject: [PATCH] Update PublicApiController, fix bug that does not show private posts in home timeline --- app/Http/Controllers/PublicApiController.php | 6 ++++++ config/instance.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index dce50d009..bd22505e3 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -211,6 +211,10 @@ class PublicApiController extends Controller 'limit' => 'nullable|integer|max:20' ]); + if(config('instance.timeline.local.is_public') == false && !Auth::check()) { + abort(403, 'Authentication required.'); + } + $page = $request->input('page'); $min = $request->input('min_id'); $max = $request->input('max_id'); @@ -331,6 +335,8 @@ class PublicApiController extends Controller ->orWhere('status', '!=', null) ->pluck('id'); }); + + $private = $private->diff($following)->flatten(); $filters = UserFilter::whereUserId($pid) ->whereFilterableType('App\Profile') diff --git a/config/instance.php b/config/instance.php index 6fc04c902..9f4f249f6 100644 --- a/config/instance.php +++ b/config/instance.php @@ -11,5 +11,11 @@ return [ 'announcement' => [ 'enabled' => env('INSTANCE_ANNOUNCEMENT_ENABLED', true), 'message' => env('INSTANCE_ANNOUNCEMENT_MESSAGE', 'Example announcement message.
Something else here') + ], + + 'timeline' => [ + 'local' => [ + 'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false) + ] ] ]; \ No newline at end of file