mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
Update comment apis
This commit is contained in:
parent
f0e48a09a3
commit
063558e3ac
2 changed files with 8 additions and 6 deletions
|
@ -132,13 +132,15 @@ class InternalApiController extends Controller
|
||||||
|
|
||||||
public function statusReplies(Request $request, int $id)
|
public function statusReplies(Request $request, int $id)
|
||||||
{
|
{
|
||||||
|
$this->validate($request, [
|
||||||
|
'limit' => 'nullable|int|min:1|max:6'
|
||||||
|
]);
|
||||||
$parent = Status::whereScope('public')->findOrFail($id);
|
$parent = Status::whereScope('public')->findOrFail($id);
|
||||||
|
$limit = $request->input('limit') ?? 3;
|
||||||
$children = Status::whereInReplyToId($parent->id)
|
$children = Status::whereInReplyToId($parent->id)
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->take(3)
|
->take($limit)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$resource = new Fractal\Resource\Collection($children, new StatusTransformer());
|
$resource = new Fractal\Resource\Collection($children, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ class PublicApiController extends Controller
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->whereIn('scope', $scope)
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
->select('id', 'caption', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
->select('id', 'caption', 'local', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||||
->where('id', '>=', $request->min_id)
|
->where('id', '>=', $request->min_id)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
@ -176,7 +176,7 @@ class PublicApiController extends Controller
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->whereIn('scope', $scope)
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
->select('id', 'caption', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
->select('id', 'caption', 'local', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||||
->where('id', '<=', $request->max_id)
|
->where('id', '<=', $request->max_id)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
@ -186,7 +186,7 @@ class PublicApiController extends Controller
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->whereIn('scope', $scope)
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
->select('id', 'caption', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
->select('id', 'caption', 'local', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue