Update ApiV1Controller, fix private status replies returning 404

This commit is contained in:
Daniel Supernault 2022-01-28 20:04:02 -07:00
parent a11772bcfe
commit 73226360fc
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2514,9 +2514,15 @@ class ApiV1Controller extends Controller
$limit = $request->input('limit', 3); $limit = $request->input('limit', 3);
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
$status = StatusService::getMastodon($id); $status = StatusService::getMastodon($id, false);
abort_if(!$status || !in_array($status['visibility'], ['public', 'unlisted']), 404); abort_if(!$status, 404);
if($status['visibility'] == 'private') {
if($pid != $status['account']['id']) {
abort_unless(FollowerService::follows($pid, $status['account']['id']), 404);
}
}
$sortBy = $request->input('sort', 'all'); $sortBy = $request->input('sort', 'all');