mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
Merge pull request #172 from gordonbanderson/issue170_can_reply_spam
FIX: Take account of spam/moderation status when enabling replies
This commit is contained in:
commit
7721c20e80
@ -665,8 +665,9 @@ class Comment extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if depth is limited
|
// Check if depth is limited
|
||||||
$maxLevel = $this->getOption('nested_depth');
|
$maxLevel = $this->getOption('nested_depth');
|
||||||
return !$maxLevel || $this->Depth < $maxLevel;
|
$notSpam = ($this->SpamClass() == 'notspam');
|
||||||
|
return $notSpam && (!$maxLevel || $this->Depth < $maxLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -966,6 +966,25 @@ class CommentsTest extends FunctionalTest {
|
|||||||
|
|
||||||
$comment->Depth = 4;
|
$comment->Depth = 4;
|
||||||
$this->assertFalse($comment->getRepliesEnabled());
|
$this->assertFalse($comment->getRepliesEnabled());
|
||||||
|
|
||||||
|
|
||||||
|
// 0 indicates no limit for nested_depth
|
||||||
|
Config::inst()->update('CommentableItem', 'comments', array(
|
||||||
|
'nested_comments' => true,
|
||||||
|
'nested_depth' => 0
|
||||||
|
));
|
||||||
|
|
||||||
|
$comment->Depth = 234;
|
||||||
|
$this->assertTrue($comment->getRepliesEnabled());
|
||||||
|
$comment->markUnapproved();
|
||||||
|
$this->assertFalse($comment->getRepliesEnabled());
|
||||||
|
$comment->markSpam();
|
||||||
|
$this->assertFalse($comment->getRepliesEnabled());
|
||||||
|
|
||||||
|
$comment->markApproved();
|
||||||
|
$this->assertTrue($comment->getRepliesEnabled());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAllReplies() {
|
public function testAllReplies() {
|
||||||
|
Loading…
Reference in New Issue
Block a user