diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 3b017ad9..a38018c5 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1407,11 +1407,32 @@ class ApiV1Controller extends Controller $status = Status::whereVisibility('public')->findOrFail($id); - // Return empty response since we don't handle threading like this - $res = [ - 'ancestors' => [], - 'descendants' => [] - ]; + // Return empty response since we don't handle support cards + $res = []; + + return response()->json($res); + } + + /** + * GET /api/v1/statuses/{id}/reblogged_by + * + * @param integer $id + * + * @return AccountTransformer + */ + public function statusRebloggedBy(Request $request, $id) + { + abort_if(!$request->user(), 403); + + $this->validate($request, [ + 'limit' => 'nullable|integer|min:1|max:80' + ]); + + $limit = $request->input('limit') ?? 40; + $status = Status::whereVisibility('public')->findOrFail($id); + $shared = $status->sharedBy()->latest()->simplePaginate($limit); + $resource = new Fractal\Resource\Collection($shared, new AccountTransformer()); + $res = $this->fractal->createData($resource)->toArray(); return response()->json($res); } diff --git a/routes/web.php b/routes/web.php index 19ac6c7b..98ebf64c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -119,6 +119,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById')->middleware('auth:api'); Route::get('statuses/{id}/context', 'Api\ApiV1Controller@statusContext')->middleware('auth:api'); Route::get('statuses/{id}/card', 'Api\ApiV1Controller@statusCard')->middleware('auth:api'); + Route::get('statuses/{id}/reblogged_by', 'Api\ApiV1Controller@statusRebloggedBy')->middleware('auth:api'); Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api'); Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api');