Skip to content

Commit

Permalink
pr review 2
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfyWin committed Sep 3, 2024
1 parent 99668a7 commit 0131287
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/plugin/cursus/Controller/CourseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ protected function getDefaultHiddenFilters(): array
if (!$this->checkToolAccess('EDIT')) {
$filters['hidden'] = false;
}

$filters['archived'] = false;
}

return $filters;
Expand All @@ -115,9 +117,7 @@ protected function getDefaultHiddenFilters(): array
public function listAction(Request $request): JsonResponse
{
$params = $request->query->all();
$params['hiddenFilters'] = [
'archived' => false,
];
$params['hiddenFilters'] = array_merge($this->getDefaultHiddenFilters(), $params['hiddenFilters'] ?? []);

return new JsonResponse(
$this->crud->list(Course::class, $params)
Expand All @@ -129,16 +129,16 @@ public function listAction(Request $request): JsonResponse
*/
public function listPublicAction(Request $request): JsonResponse
{
$params = $request->query->all();
$params['hiddenFilters'] = [
'public' => true,
];

return new JsonResponse(
$this->crud->list(Course::class, $params)
);
return new JsonResponse($this->crud->list(
Course::class,
array_merge($request->query->all(), ['hiddenFilters' => array_merge($this->getDefaultHiddenFilters(), [
'public' => true,
])]),
$this->getOptions()['list']
));
}


/**
* @Route("/list/archived", name="apiv2_cursus_course_list_archived", methods={"GET"})
*/
Expand Down

0 comments on commit 0131287

Please sign in to comment.