diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 9830de5e6..c60fc5d70 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -911,7 +911,9 @@ class commentController extends comment { return new BaseObject(-1, 'msg_invalid_request'); } - $comment = getModel('comment')->getComment($obj->comment_srl); + + // check if comment exists and permission is granted + $comment = CommentModel::getComment($obj->comment_srl); if(!$comment->isExists()) { return new BaseObject(-1, 'msg_not_founded'); @@ -928,17 +930,6 @@ class commentController extends comment return $output; } - // check if comment exists and permission is granted - $comment = CommentModel::getComment($obj->comment_srl); - if(!$comment->isExists()) - { - return new BaseObject(-1, 'msg_not_founded'); - } - if(!$is_admin && !$comment->isGranted()) - { - return new BaseObject(-1, 'msg_not_permitted'); - } - // If the case manager to delete comments, it indicated that the administrator deleted. $logged_info = Context::get('logged_info'); if($is_admin === true && $obj->member_srl !== $logged_info->member_srl) @@ -1197,7 +1188,7 @@ class commentController extends comment function moveCommentToTrash($obj, $updateComment = false) { // check if comment exists and permission is granted - $oComment = CommentModel::getComment($obj->comment_srl); + $oComment = ($obj instanceof commentItem) ? $obj : CommentModel::getComment($obj->comment_srl); if(!$oComment->isExists()) { return new BaseObject(-1, 'msg_not_founded');