mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update ApiV1Controller, fix accountStatusesById endpoint
This commit is contained in:
parent
15eccd443c
commit
db7b1af343
2 changed files with 11 additions and 9 deletions
|
@ -540,8 +540,11 @@ class ApiV1Controller extends Controller
|
|||
'limit' => 'nullable|integer|min:1|max:100'
|
||||
]);
|
||||
|
||||
$profile = AccountService::getMastodon($id);
|
||||
abort_if(!$profile, 404);
|
||||
$profile = AccountService::getMastodon($id, true);
|
||||
|
||||
if(!$profile || !isset($profile['id']) || !$user) {
|
||||
return response('', 404);
|
||||
}
|
||||
|
||||
$limit = $request->limit ?? 20;
|
||||
$max_id = $request->max_id;
|
||||
|
@ -567,7 +570,9 @@ class ApiV1Controller extends Controller
|
|||
$visibility = ['public', 'unlisted', 'private'];
|
||||
} else if($profile['locked']) {
|
||||
$following = FollowerService::follows($pid, $profile['id']);
|
||||
abort_unless($following, 403);
|
||||
if(!$following) {
|
||||
return response('', 403);
|
||||
}
|
||||
$visibility = ['public', 'unlisted', 'private'];
|
||||
} else {
|
||||
$following = FollowerService::follows($pid, $profile['id']);
|
||||
|
@ -586,11 +591,8 @@ class ApiV1Controller extends Controller
|
|||
->orderByDesc('id')
|
||||
->get()
|
||||
->map(function($s) use($user) {
|
||||
try {
|
||||
$status = StatusService::getMastodon($s->id, false);
|
||||
} catch (\Exception $e) {
|
||||
$status = false;
|
||||
}
|
||||
$status = StatusService::getMastodon($s->id, false);
|
||||
|
||||
if($user && $status) {
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
|
|||
Route::post('accounts/{id}/unmute', 'Api\ApiV1Controller@accountUnmuteById')->middleware($middleware);
|
||||
Route::get('accounts/{id}/lists', 'Api\ApiV1Controller@accountListsById')->middleware($middleware);
|
||||
Route::get('lists/{id}/accounts', 'Api\ApiV1Controller@accountListsById')->middleware($middleware);
|
||||
Route::get('accounts/{id}', 'Api\ApiV1Controller@accountById');
|
||||
Route::get('accounts/{id}', 'Api\ApiV1Controller@accountById')->middleware($middleware);
|
||||
|
||||
Route::post('avatar/update', 'ApiController@avatarUpdate')->middleware($middleware);
|
||||
Route::get('blocks', 'Api\ApiV1Controller@accountBlocks')->middleware($middleware);
|
||||
|
|
Loading…
Reference in a new issue