mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update PublicApiController, use AccountService in accountStatuses method
This commit is contained in:
parent
80d9b9399a
commit
bef959f451
1 changed files with 71 additions and 78 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue