BUG FIx "your comment is awaiting moderation" and "your comment is rejected as spam" messages appearing together.

This commit is contained in:
Damian Mooyman 2015-04-24 14:28:40 +12:00
parent 651a4e4977
commit d0cd57104d

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);