mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Add /api/v1/statuses/{id}/reblogged_by endpoint
This commit is contained in:
parent
9225120835
commit
118006ed2d
2 changed files with 27 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue