Skip to content

Commit

Permalink
MDL-64588 core_comment: fix unnecessary type check in add_comments
Browse files Browse the repository at this point in the history
We should rely on the return type, else an exception with be thrown.
  • Loading branch information
snake committed Oct 2, 2019
1 parent 93ea661 commit 0c3eaf9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions comment/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,8 @@ public static function add_comments($comments) {
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;
Expand Down

0 comments on commit 0c3eaf9

Please sign in to comment.