mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Add /api/v1/mutes endpoint
This commit is contained in:
parent
fcf231f430
commit
b280d183ad
2 changed files with 32 additions and 1 deletions
|
@ -995,6 +995,36 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/v1/mutes
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return App\Transformer\Api\AccountTransformer
|
||||||
|
*/
|
||||||
|
public function accountMutes(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
|
$this->validate($request, [
|
||||||
|
'limit' => 'nullable|integer|min:1|max:40'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = $request->user();
|
||||||
|
$limit = $request->input('limit') ?? 40;
|
||||||
|
|
||||||
|
$mutes = UserFilter::whereUserId($user->profile_id)
|
||||||
|
->whereFilterableType('App\Profile')
|
||||||
|
->whereFilterType('mute')
|
||||||
|
->simplePaginate($limit)
|
||||||
|
->pluck('filterable_id');
|
||||||
|
|
||||||
|
$accounts = Profile::find($mutes);
|
||||||
|
|
||||||
|
$resource = new Fractal\Resource\Collection($accounts, new AccountTransformer());
|
||||||
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
|
return response()->json($res);
|
||||||
|
}
|
||||||
|
|
||||||
public function statusById(Request $request, $id)
|
public function statusById(Request $request, $id)
|
||||||
{
|
{
|
||||||
$status = Status::whereVisibility('public')->findOrFail($id);
|
$status = Status::whereVisibility('public')->findOrFail($id);
|
||||||
|
|
|
@ -112,6 +112,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::get('lists/{id}/accounts', 'Api\ApiV1Controller@accountListsById')->middleware('auth:api');
|
Route::get('lists/{id}/accounts', 'Api\ApiV1Controller@accountListsById')->middleware('auth:api');
|
||||||
Route::post('media', 'Api\ApiV1Controller@mediaUpload')->middleware('auth:api');
|
Route::post('media', 'Api\ApiV1Controller@mediaUpload')->middleware('auth:api');
|
||||||
Route::put('media/{id}', 'Api\ApiV1Controller@mediaUpdate')->middleware('auth:api');
|
Route::put('media/{id}', 'Api\ApiV1Controller@mediaUpdate')->middleware('auth:api');
|
||||||
|
Route::get('mutes', 'Api\ApiV1Controller@accountMutes')->middleware('auth:api');
|
||||||
|
|
||||||
// Route::get('likes', 'ApiController@hydrateLikes');
|
// Route::get('likes', 'ApiController@hydrateLikes');
|
||||||
// Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
// Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
||||||
|
|
Loading…
Reference in a new issue