From c0a01dbc91ace606e3cc5ab6fa0e16c6dd41b9aa Mon Sep 17 00:00:00 2001 From: micmania1 Date: Tue, 3 Jul 2018 11:00:40 +1200 Subject: [PATCH] BUGFIX created way of knowing whether user has permission to post --- src/Model/Comment.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Model/Comment.php b/src/Model/Comment.php index bc2c3d2..0dd6eec 100755 --- a/src/Model/Comment.php +++ b/src/Model/Comment.php @@ -765,6 +765,20 @@ class Comment extends DataObject return $notSpam && (!$maxLevel || $this->Depth < $maxLevel); } + /** + * Proxy for checking whether the has permission to comment on the comment parent. + * + * @param Member $member Member to check + * + * @return boolean + */ + public function canPostComment($member = null) + { + return $this->Parent() + && $this->Parent()->exists() + && $this->Parent()->canPostComment($member); + } + /** * Returns the list of all replies *