forked from mirror/pixelfed
Update BaseApiController@accountStatuses, handle visibility scope properly
This commit is contained in:
parent
c1f66b968e
commit
bfa04b7ad7
1 changed files with 7 additions and 1 deletions
|
@ -57,8 +57,14 @@ class BaseApiController extends Controller
|
|||
|
||||
public function accountStatuses(Request $request, $id)
|
||||
{
|
||||
$pid = Auth::user()->profile->id;
|
||||
$profile = Profile::findOrFail($id);
|
||||
$statuses = $profile->statuses()->orderBy('id', 'desc')->paginate(20);
|
||||
$statuses = $profile->statuses();
|
||||
if($pid === $profile->id) {
|
||||
$statuses = $statuses->orderBy('id', 'desc')->paginate(20);
|
||||
} else {
|
||||
$statuses = $statuses->whereVisibility('public')->orderBy('id', 'desc')->paginate(20);
|
||||
}
|
||||
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
|
||||
|
|
Loading…
Reference in a new issue