diff --git a/classes/comment.php b/classes/comment.php index 32d214d..a855e5e 100644 --- a/classes/comment.php +++ b/classes/comment.php @@ -149,11 +149,11 @@ public static function can_create($context) { public function can_delete() { global $USER; - if ($this->userid == $USER->id) { + $context = $this->get_context(); + if ($this->userid == $USER->id && has_capability('mod/board:postcomment', $context)) { return true; } - $context = $this->get_context(); if (has_capability('mod/board:deleteallcomments', $context)) { return true; } diff --git a/external.php b/external.php index cb20e42..c35cac0 100755 --- a/external.php +++ b/external.php @@ -709,7 +709,7 @@ public static function get_comments($noteid) { $comment->id = $note->id; $comment->noteid = $note->noteid; $comment->content = $note->content; - $comment->candelete = ($note->userid === $USER->id || $candeleteall) ? true : false; + $comment->candelete = (($canpost && $note->userid === $USER->id) || $candeleteall) ? true : false; $comment->date = userdate($note->timecreated); $comments[] = $comment; }