mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Add /api/v1/statuses/{id}/favourited_by endpoint
This commit is contained in:
parent
118006ed2d
commit
5cdff57d59
2 changed files with 25 additions and 0 deletions
|
@ -1437,6 +1437,30 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/v1/statuses/{id}/favourited_by
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
*
|
||||||
|
* @return AccountTransformer
|
||||||
|
*/
|
||||||
|
public function statusFavouritedBy(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);
|
||||||
|
$liked = $status->likedBy()->latest()->simplePaginate($limit);
|
||||||
|
$resource = new Fractal\Resource\Collection($liked, new AccountTransformer());
|
||||||
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
|
|
||||||
|
return response()->json($res);
|
||||||
|
}
|
||||||
|
|
||||||
public function createStatus(Request $request)
|
public function createStatus(Request $request)
|
||||||
{
|
{
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
|
@ -120,6 +120,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@statusContext')->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}/card', 'Api\ApiV1Controller@statusCard')->middleware('auth:api');
|
||||||
Route::get('statuses/{id}/reblogged_by', 'Api\ApiV1Controller@statusRebloggedBy')->middleware('auth:api');
|
Route::get('statuses/{id}/reblogged_by', 'Api\ApiV1Controller@statusRebloggedBy')->middleware('auth:api');
|
||||||
|
Route::get('statuses/{id}/favourited_by', 'Api\ApiV1Controller@statusFavouritedBy')->middleware('auth:api');
|
||||||
|
|
||||||
Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api');
|
Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api');
|
||||||
Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api');
|
Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api');
|
||||||
|
|
Loading…
Reference in a new issue