Update ApiController

This commit is contained in:
Daniel Supernault 2019-09-28 23:00:31 -06:00
parent 7e0f9ac3d4
commit 10cb2d4004
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 16 additions and 4 deletions

View file

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

View file

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