From ed6ebc84f4f7aa1052dc7a481aee176051694851 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 1 Dec 2018 23:41:19 -0700 Subject: [PATCH] Update InternalApiController --- app/Http/Controllers/InternalApiController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index ae8a45ef3..d21b8eaba 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -53,6 +53,7 @@ class InternalApiController extends Controller $medias = $request->input('media'); $attachments = []; $status = new Status; + $mimes = []; foreach($medias as $k => $media) { $m = Media::findOrFail($media['id']); @@ -69,6 +70,7 @@ class InternalApiController extends Controller } $m->save(); $attachments[] = $m; + array_push($mimes, $m->mime); } $status->caption = strip_tags($request->caption); @@ -84,6 +86,7 @@ class InternalApiController extends Controller $status->visibility = $visibility; $status->scope = $visibility; + $status->type = StatusController::mimeTypeCheck($mimes); $status->save(); NewStatusPipeline::dispatch($status); @@ -96,6 +99,7 @@ class InternalApiController extends Controller $this->validate($request, [ 'page' => 'nullable|min:1|max:3', ]); + $profile = Auth::user()->profile; $timeago = Carbon::now()->subMonths(6); $notifications = Notification::with('actor') @@ -148,8 +152,7 @@ class InternalApiController extends Controller ->get(); $posts = Status::select('id', 'caption', 'profile_id') - ->whereNull('in_reply_to_id') - ->whereNull('reblog_of_id') + ->whereHas('media') ->whereIsNsfw(false) ->whereVisibility('public') ->whereNotIn('profile_id', $following) @@ -233,8 +236,7 @@ class InternalApiController extends Controller $following = array_merge($following, $filters); $posts = Status::select('id', 'caption', 'profile_id') - ->whereNull('in_reply_to_id') - ->whereNull('reblog_of_id') + ->whereHas('media') ->whereIsNsfw(false) ->whereVisibility('public') ->whereNotIn('profile_id', $following)