BUGFIX created way of knowing whether user has permission to post

This commit is contained in:
micmania1 2018-07-03 11:00:40 +12:00
parent 6d7b14367a
commit c0a01dbc91
1 changed files with 14 additions and 0 deletions

View File

@ -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
*