forked from mirror/pixelfed
Update ApiV1Controller, fix self relationship response
This commit is contained in:
parent
b29527cf53
commit
28bc7aa439
|
@ -972,10 +972,22 @@ class ApiV1Controller extends Controller
|
||||||
$napi = $request->has(self::PF_API_ENTITY_KEY);
|
$napi = $request->has(self::PF_API_ENTITY_KEY);
|
||||||
$pid = $request->user()->profile_id ?? $request->user()->profile->id;
|
$pid = $request->user()->profile_id ?? $request->user()->profile->id;
|
||||||
$res = collect($ids)
|
$res = collect($ids)
|
||||||
->filter(function ($id) use ($pid) {
|
|
||||||
return intval($id) !== intval($pid);
|
|
||||||
})
|
|
||||||
->map(function ($id) use ($pid, $napi) {
|
->map(function ($id) use ($pid, $napi) {
|
||||||
|
if (intval($id) === intval($pid)) {
|
||||||
|
return [
|
||||||
|
'id' => $id,
|
||||||
|
'following' => false,
|
||||||
|
'followed_by' => false,
|
||||||
|
'blocking' => false,
|
||||||
|
'muting' => false,
|
||||||
|
'muting_notifications' => false,
|
||||||
|
'requested' => false,
|
||||||
|
'domain_blocking' => false,
|
||||||
|
'showing_reblogs' => false,
|
||||||
|
'endorsed' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $napi ?
|
return $napi ?
|
||||||
RelationshipService::getWithDate($pid, $id) :
|
RelationshipService::getWithDate($pid, $id) :
|
||||||
RelationshipService::get($pid, $id);
|
RelationshipService::get($pid, $id);
|
||||||
|
|
Loading…
Reference in New Issue