Merge pull request #261 from micmania1/bugfix/canpostcomment-not-passed-to-include

BUGFIX canPostComment was being called out of scope
This commit is contained in:
Robbie Averill 2018-07-03 11:43:34 +12:00 committed by GitHub
commit 19619b083e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
*