Update PublicApiController

This commit is contained in:
Daniel Supernault 2019-03-31 21:30:16 -06:00
parent 718d9a0452
commit dbaf903d68
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 5 additions and 5 deletions

View File

@ -110,7 +110,7 @@ class PublicApiController extends Controller
]);
$limit = $request->limit ?? 10;
$profile = Profile::whereUsername($username)->whereNull('status')->firstOrFail();
$status = Status::whereProfileId($profile->id)->findOrFail($postId);
$status = Status::whereProfileId($profile->id)->whereCommentsDisabled(false)->findOrFail($postId);
$this->scopeCheck($profile, $status);
if($request->filled('min_id') || $request->filled('max_id')) {
if($request->filled('min_id')) {
@ -578,9 +578,9 @@ 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'];
$visibility = true == in_array($profile->id, $following) ? ['public', 'unlisted', 'private'] : ['public', 'unlisted'];
} else {
$visibility = ['public'];
$visibility = ['public', 'unlisted'];
}
}
@ -606,8 +606,8 @@ class PublicApiController extends Controller
->whereLocal(true)
->whereNull('uri')
->where('id', $dir, $id)
->whereIn('visibility',$visibility)
->orderBy('created_at', 'desc')
->whereIn('visibility', $visibility)
->latest()
->limit($limit)
->get();