Skip to content

Commit

Permalink
Merge pull request #123 from tractorcow/pulls/2.0/fix-spam-moderation
Browse files Browse the repository at this point in the history
BUG Fix "your comment is awaiting moderation" and "your comment is rejected as spam" messages appearing together.
  • Loading branch information
assertchris committed Apr 24, 2015
2 parents 651a4e4 + d0cd571 commit 304dee2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions code/controllers/CommentingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,6 @@ public function doPostComment($data, $form) {
$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);
Expand All @@ -552,6 +547,11 @@ public function doPostComment($data, $form) {
// 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);
Expand Down

0 comments on commit 304dee2

Please sign in to comment.