Skip to content

Commit 81d424b

Browse files
committed
feat(api): added configuration for public questions in API, closes #3876
1 parent 433b5e6 commit 81d424b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

phpmyfaq/src/phpMyFAQ/Controller/Api/OpenQuestionController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ public function list(): JsonResponse
122122
/** @var Question $question */
123123
$question = $this->container?->get(id: 'phpmyfaq.question');
124124

125+
$onlyPublic = (bool) $this->configuration->get('api.onlyPublicQuestions');
126+
125127
// Get pagination and sorting parameters
126128
$pagination = $this->getPaginationRequest();
127129
$sort = $this->getSortRequest(
@@ -131,7 +133,7 @@ public function list(): JsonResponse
131133
);
132134

133135
// Get all open questions
134-
$allQuestions = $question->getAll(false);
136+
$allQuestions = $question->getAll($onlyPublic);
135137
$total = is_countable($allQuestions) ? count($allQuestions) : 0;
136138

137139
// Apply sorting if needed

0 commit comments

Comments
 (0)