mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Add /api/v1/follow_requests endpoint
This commit is contained in:
parent
b3d82edd0f
commit
9726913622
2 changed files with 23 additions and 0 deletions
|
@ -746,6 +746,28 @@ class ApiV1Controller extends Controller
|
|||
return response()->json([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/follow_requests
|
||||
*
|
||||
* Return array of Accounts that have sent follow requests
|
||||
*
|
||||
* @return \App\Transformer\Api\AccountTransformer
|
||||
*/
|
||||
public function accountFollowRequests(Request $request)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
$followRequests = FollowRequest::whereFollowingId($user->profile->id)->pluck('follower_id');
|
||||
|
||||
$profiles = Profile::find($followRequests);
|
||||
|
||||
$resource = new Fractal\Resource\Collection($profiles, new AccountTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
public function statusById(Request $request, $id)
|
||||
{
|
||||
$status = Status::whereVisibility('public')->findOrFail($id);
|
||||
|
|
|
@ -103,6 +103,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::post('statuses/{id}/favourite', 'Api\ApiV1Controller@statusFavouriteById')->middleware('auth:api');
|
||||
Route::post('statuses/{id}/unfavourite', 'Api\ApiV1Controller@statusUnfavouriteById')->middleware('auth:api');
|
||||
Route::get('filters', 'Api\ApiV1Controller@accountFilters')->middleware('auth:api');
|
||||
Route::get('follow_requests', 'Api\ApiV1Controller@accountFollowRequests')->middleware('auth:api');
|
||||
|
||||
Route::get('likes', 'ApiController@hydrateLikes');
|
||||
Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
||||
|
|
Loading…
Reference in a new issue