MDL-64588 core_comment: fix unnecessary type check in add_comments

We should rely on the return type, else an exception with be thrown.
This commit is contained in:
Jake Dallimore 2019-09-17 11:43:22 +08:00
parent 93ea6612bd
commit 0c3eaf9ee6

View File

@ -254,10 +254,8 @@ class core_comment_external extends external_api {
foreach ($params['comments'] as $comment) {
$manager = $comment['preparedcomment'];
$newcomment = $manager->add($comment['content']);
if (!empty($newcomment) && is_object($newcomment)) {
$results[] = $newcomment;
}
$newcomment->delete = true; // USER created the comment, so they can delete it.
$results[] = $newcomment;
}
return $results;