diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-09-26 12:43:19 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-09-26 12:43:19 +0000 |
| commit | 4c88f5832ea01ec280f699301e287a79adfb6e7e (patch) | |
| tree | a1972a719c5a0f346ca68186bd4add27157d4882 /lib | |
| parent | 8e60532f96147276b025b52e6d2bb51ff7b81a2c (diff) | |
fixes #3232
Closes #3232
Merge request studip/studip!2193
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/classes/JsonApi/Routes/Blubber/CommentsCreate.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/classes/JsonApi/Routes/Blubber/CommentsCreate.php b/lib/classes/JsonApi/Routes/Blubber/CommentsCreate.php index 6d95020..2e25d3f 100644 --- a/lib/classes/JsonApi/Routes/Blubber/CommentsCreate.php +++ b/lib/classes/JsonApi/Routes/Blubber/CommentsCreate.php @@ -54,9 +54,14 @@ class CommentsCreate extends JsonApiController 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.'; } + if (!$id && !$this->getThreadFromJson($json)) { return 'Invalid `block` relationship.'; } |
