From 10cb2d40048a2063fc8d70bf66b81ab2c1807cce Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 28 Sep 2019 23:00:31 -0600 Subject: [PATCH] Update ApiController --- app/Http/Controllers/Api/ApiV1Controller.php | 18 +++++++++++++++--- routes/web.php | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index b8fee3d78..edc8e5fab 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1469,7 +1469,7 @@ class ApiV1Controller extends Controller * * @return StatusTransformer */ - public function createStatus(Request $request) + public function statusCreate(Request $request) { abort_if(!$request->user(), 403); @@ -1510,7 +1510,7 @@ class ApiV1Controller extends Controller $status->scope = $request->input('visibility'); $status->visibility = $request->input('visibility'); $status->profile_id = $user->profile_id; - $status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive'); + $status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false); $status->in_reply_to_id = $parent->id; $status->in_reply_to_profile_id = $parent->profile_id; $status->save(); @@ -1519,7 +1519,7 @@ class ApiV1Controller extends Controller $status->caption = strip_tags($request->input('status')); $status->profile_id = $user->profile_id; $status->scope = 'draft'; - $status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive'); + $status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false); $status->save(); $mimes = []; @@ -1562,4 +1562,16 @@ class ApiV1Controller extends Controller $res = $this->fractal->createData($resource)->toArray(); return response()->json($res); } + + /** + * DELETE /api/v1/statuses + * + * @param integer $id + * + * @return null + */ + public function statusDelete(Request $request) + { + abort_if(!$request->user(), 403); + } } \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b9063cc02..c534bcde8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -125,7 +125,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api'); Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api'); Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic'); - Route::post('statuses', 'Api\ApiV1Controller@createStatus')->middleware('auth:api'); + Route::post('statuses', 'Api\ApiV1Controller@statusCreate')->middleware('auth:api'); // Route::get('likes', 'ApiController@hydrateLikes'); // Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');