Update CollectionController

This commit is contained in:
Daniel Supernault 2022-09-30 22:23:58 -06:00
parent 5ec25204ca
commit ab2d1315a0
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -175,6 +175,11 @@ class CollectionController extends Controller
{ {
$user = $request->user(); $user = $request->user();
$collection = CollectionService::getCollection($id); $collection = CollectionService::getCollection($id);
if(!$collection) {
return response()->json([], 404);
}
if($collection['published_at'] == null || $collection['visibility'] != 'public') { if($collection['published_at'] == null || $collection['visibility'] != 'public') {
abort_unless($user, 404); abort_unless($user, 404);
if($user->profile_id != $collection['pid']) { if($user->profile_id != $collection['pid']) {
@ -192,6 +197,11 @@ class CollectionController extends Controller
{ {
$user = $request->user(); $user = $request->user();
$collection = CollectionService::getCollection($id); $collection = CollectionService::getCollection($id);
if(!$collection) {
return response()->json([], 404);
}
if($collection['published_at'] == null || $collection['visibility'] != 'public') { if($collection['published_at'] == null || $collection['visibility'] != 'public') {
abort_unless($user, 404); abort_unless($user, 404);
if($user->profile_id != $collection['pid']) { if($user->profile_id != $collection['pid']) {