Skip to content
Snippets Groups Projects
Commit 4c88f583 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #3232

Closes #3232

Merge request studip/studip!2193
parent 8e60532f
No related branches found
No related tags found
No related merge requests found
...@@ -54,9 +54,14 @@ class CommentsCreate extends JsonApiController ...@@ -54,9 +54,14 @@ class CommentsCreate extends JsonApiController
protected function validateResourceDocument($json, $id = null) protected function validateResourceDocument($json, $id = null)
{ {
if (empty(self::arrayGet($json, 'data.attributes.content'))) { if (!self::arrayHas($json, 'data.attributes.content')) {
return 'No comment provided';
}
if (mb_strlen(trim(self::arrayGet($json, 'data.attributes.content'))) === 0) {
return 'Comment should not be empty.'; return 'Comment should not be empty.';
} }
if (!$id && !$this->getThreadFromJson($json)) { if (!$id && !$this->getThreadFromJson($json)) {
return 'Invalid `block` relationship.'; return 'Invalid `block` relationship.';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment