Merge pull request #123 from tractorcow/pulls/2.0/fix-spam-moderation

BUG Fix "your comment is awaiting moderation" and "your comment is rejected as spam" messages appearing together.
This commit is contained in:
Christopher Pitt 2015-04-24 15:16:49 +12:00
commit 304dee2792

View File

@ -529,11 +529,6 @@ class CommentingController extends Controller {
$requireModeration = false;
break;
}
// we want to show a notification if comments are moderated
if ($requireModeration) {
Session::set('CommentsModerated', 1);
}
$comment = new Comment();
$form->saveInto($comment);
@ -552,6 +547,11 @@ class CommentingController extends Controller {
// extend hook to allow extensions. Also see onBeforePostComment
$this->extend('onAfterPostComment', $comment);
}
// we want to show a notification if comments are moderated
if ($requireModeration && !$comment->IsSpam) {
Session::set('CommentsModerated', 1);
}
// clear the users comment since it passed validation
Cookie::set('CommentsForm_Comment', false);