Update PublicApiController, use AccountService in accountStatuses method

This commit is contained in:
Daniel Supernault 2021-10-07 03:30:23 -06:00
parent 80d9b9399a
commit bef959f451
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -676,14 +676,15 @@ class PublicApiController extends Controller
]);
$user = $request->user();
$profile = Profile::whereNull('status')->findOrFail($id);
$profile = AccountService::get($id);
abort_if(!$profile, 404);
$limit = $request->limit ?? 9;
$max_id = $request->max_id;
$min_id = $request->min_id;
$scope = ['photo', 'photo:album', 'video', 'video:album'];
if($profile->is_private) {
if($profile['locked']) {
if(!$user) {
return response()->json([]);
}
@ -700,7 +701,7 @@ class PublicApiController extends Controller
$following = Follower::whereProfileId($pid)->pluck('following_id');
return $following->push($pid)->toArray();
});
$visibility = true == in_array($profile->id, $following) ? ['public', 'unlisted', 'private'] : ['public', 'unlisted'];
$visibility = true == in_array($profile['id'], $following) ? ['public', 'unlisted', 'private'] : ['public', 'unlisted'];
} else {
$visibility = ['public', 'unlisted'];
}
@ -708,15 +709,7 @@ class PublicApiController extends Controller
$dir = $min_id ? '>' : '<';
$id = $min_id ?? $max_id;
$res = Status::select(
'id',
'profile_id',
'type',
'scope',
'local',
'created_at'
)
->whereProfileId($profile->id)
$res = Status::whereProfileId($profile['id'])
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
->whereIn('type', $scope)