New proper types
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
0961fbfdd7
commit
7aa3f7ace0
4 changed files with 31 additions and 10 deletions
|
|
@ -256,11 +256,16 @@ class ApiController extends Controller {
|
|||
'text' => $text,
|
||||
]);
|
||||
|
||||
if (array_search($type, Question::TYPES) === false) {
|
||||
$this->logger->debug('Invalid type');
|
||||
return new Http\JSONResponse(['message' => 'Invalid type'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
try {
|
||||
$form = $this->formMapper->findById($formId);
|
||||
} catch (IMapperException $e) {
|
||||
$this->logger->debug('Could not find form');
|
||||
return new Http\JSONResponse([], Http::STATUS_BAD_REQUEST);
|
||||
return new Http\JSONResponse(['message' => 'Could not find form'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
if ($form->getOwnerId() !== $this->userId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue