mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-11 06:30:46 +00:00
Merge pull request #946 from pixelfed/frontend-ui-refactor
Update PublicApiController
This commit is contained in:
commit
3ef49922d2
1 changed files with 8 additions and 8 deletions
|
@ -468,10 +468,10 @@ class PublicApiController extends Controller
|
||||||
$since_id = $request->since_id ?? false;
|
$since_id = $request->since_id ?? false;
|
||||||
$only_media = $request->only_media ?? false;
|
$only_media = $request->only_media ?? false;
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account = Profile::findOrFail($id);
|
$account = Profile::whereNull('status')->findOrFail($id);
|
||||||
$statuses = $account->statuses()
|
$statuses = Status::whereProfileId($id)
|
||||||
->getQuery()
|
|
||||||
->whereNull('uri');
|
->whereNull('uri');
|
||||||
|
|
||||||
if(!$user || $user->profile->id != $account->id && !$user->profile->follows($account)) {
|
if(!$user || $user->profile->id != $account->id && !$user->profile->follows($account)) {
|
||||||
$statuses = $statuses->whereVisibility('public');
|
$statuses = $statuses->whereVisibility('public');
|
||||||
} else {
|
} else {
|
||||||
|
@ -485,21 +485,21 @@ class PublicApiController extends Controller
|
||||||
}
|
}
|
||||||
if($id == $account->id && !$max_id && !$min_id && !$since_id) {
|
if($id == $account->id && !$max_id && !$min_id && !$since_id) {
|
||||||
$statuses = $statuses->orderBy('id', 'desc')
|
$statuses = $statuses->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->simplePaginate($limit);
|
||||||
} else if($since_id) {
|
} else if($since_id) {
|
||||||
$statuses = $statuses->where('id', '>', $since_id)
|
$statuses = $statuses->where('id', '>', $since_id)
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->paginate($limit);
|
->simplePaginate($limit);
|
||||||
} else if($min_id) {
|
} else if($min_id) {
|
||||||
$statuses = $statuses->where('id', '>', $min_id)
|
$statuses = $statuses->where('id', '>', $min_id)
|
||||||
->orderBy('id', 'ASC')
|
->orderBy('id', 'ASC')
|
||||||
->paginate($limit);
|
->simplePaginate($limit);
|
||||||
} else if($max_id) {
|
} else if($max_id) {
|
||||||
$statuses = $statuses->where('id', '<', $max_id)
|
$statuses = $statuses->where('id', '<', $max_id)
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->paginate($limit);
|
->simplePaginate($limit);
|
||||||
} else {
|
} else {
|
||||||
$statuses = $statuses->orderBy('id', 'desc')->paginate($limit);
|
$statuses = $statuses->orderBy('id', 'desc')->simplePaginate($limit);
|
||||||
}
|
}
|
||||||
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
|
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
|
|
Loading…
Reference in a new issue