mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-30 11:44:59 +00:00
commit
b9f69543f3
2 changed files with 13 additions and 6 deletions
|
@ -53,6 +53,7 @@
|
||||||
- Updated ApiV1Controller, improve favourites endpoint. ([151dc17c](https://github.com/pixelfed/pixelfed/commit/151dc17c))
|
- Updated ApiV1Controller, improve favourites endpoint. ([151dc17c](https://github.com/pixelfed/pixelfed/commit/151dc17c))
|
||||||
- Updated StatusController, set missing reblog/share type. ([548a12a4](https://github.com/pixelfed/pixelfed/commit/548a12a4))
|
- Updated StatusController, set missing reblog/share type. ([548a12a4](https://github.com/pixelfed/pixelfed/commit/548a12a4))
|
||||||
- Updated index view, remove shortcut from favicon meta tag. Fixes #3196. ([6e2cb3cd](https://github.com/pixelfed/pixelfed/commit/6e2cb3cd))
|
- Updated index view, remove shortcut from favicon meta tag. Fixes #3196. ([6e2cb3cd](https://github.com/pixelfed/pixelfed/commit/6e2cb3cd))
|
||||||
|
- Updated CollectionController, fix broken unauthenticated access. Fixes #3242. ([bd249f0c](https://github.com/pixelfed/pixelfed/commit/bd249f0c))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
||||||
|
|
|
@ -17,6 +17,7 @@ use App\Transformer\Api\{
|
||||||
};
|
};
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
use League\Fractal\Serializer\ArraySerializer;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
|
use App\Services\StatusService;
|
||||||
|
|
||||||
class CollectionController extends Controller
|
class CollectionController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -166,12 +167,16 @@ class CollectionController extends Controller
|
||||||
if($collection->visibility !== 'public') {
|
if($collection->visibility !== 'public') {
|
||||||
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 404);
|
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 404);
|
||||||
}
|
}
|
||||||
$posts = $collection->posts()->orderBy('order', 'asc')->get();
|
|
||||||
|
|
||||||
$fractal = new Fractal\Manager();
|
$res = CollectionItem::whereCollectionId($id)
|
||||||
$fractal->setSerializer(new ArraySerializer());
|
->pluck('object_id')
|
||||||
$resource = new Fractal\Resource\Collection($posts, new StatusTransformer());
|
->map(function($id) {
|
||||||
$res = $fractal->createData($resource)->toArray();
|
return StatusService::get($id);
|
||||||
|
})
|
||||||
|
->filter(function($post) {
|
||||||
|
return $post && isset($post['account']);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
@ -197,11 +202,12 @@ class CollectionController extends Controller
|
||||||
->paginate(9)
|
->paginate(9)
|
||||||
->map(function($collection) {
|
->map(function($collection) {
|
||||||
return [
|
return [
|
||||||
'id' => $collection->id,
|
'id' => (string) $collection->id,
|
||||||
'title' => $collection->title,
|
'title' => $collection->title,
|
||||||
'description' => $collection->description,
|
'description' => $collection->description,
|
||||||
'thumb' => $collection->posts()->first()->thumb(),
|
'thumb' => $collection->posts()->first()->thumb(),
|
||||||
'url' => $collection->url(),
|
'url' => $collection->url(),
|
||||||
|
'post_count' => $collection->posts()->count(),
|
||||||
'published_at' => $collection->published_at
|
'published_at' => $collection->published_at
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue