mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 07:42:41 +00:00
Update AccountController, add followRequestJson method
This commit is contained in:
parent
996866cbac
commit
483548e217
1 changed files with 21 additions and 0 deletions
|
@ -327,6 +327,27 @@ class AccountController extends Controller
|
|||
return view('account.follow-requests', compact('followers'));
|
||||
}
|
||||
|
||||
public function followRequestsJson(Request $request)
|
||||
{
|
||||
$pid = Auth::user()->profile_id;
|
||||
$followers = FollowRequest::whereFollowingId($pid)->orderBy('id','desc')->whereIsRejected(0)->get();
|
||||
$res = [
|
||||
'count' => $followers->count(),
|
||||
'accounts' => $followers->take(10)->map(function($a) {
|
||||
$actor = $a->actor;
|
||||
return [
|
||||
'id' => $actor->id,
|
||||
'username' => $actor->username,
|
||||
'avatar' => $actor->avatarUrl(),
|
||||
'url' => $actor->url(),
|
||||
'local' => $actor->domain == null,
|
||||
'following' => $actor->followedBy(Auth::user()->profile)
|
||||
];
|
||||
})
|
||||
];
|
||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
|
||||
public function followRequestHandle(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
|
|
Loading…
Reference in a new issue