FIX: use template for storing pending comment message.

This commit is contained in:
Will Rossiter 2012-07-22 13:50:17 +12:00
parent 8819fb8381
commit a3328641e7
3 changed files with 8 additions and 7 deletions

View File

@ -357,19 +357,17 @@ class CommentingController extends Controller {
$comment->Moderated = ($moderated) ? false : true; $comment->Moderated = ($moderated) ? false : true;
$comment->write(); $comment->write();
$moderationMsg = _t('CommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");
// clear the users comment since it passed validation // clear the users comment since it passed validation
Cookie::set('CommentsForm_Comment', false); Cookie::set('CommentsForm_Comment', false);
if(Director::is_ajax()) { if(Director::is_ajax()) {
if($comment->NeedsModeration){ if(!$comment->Moderated) {
echo $moderationMsg; echo $comment->renderWith('CommentInterface_pendingcomment');
} else { } else {
echo $comment->renderWith('CommentInterface_singlecomment'); echo $comment->renderWith('CommentInterface_singlecomment');
} }
return false; return true;
} }
if($comment->NeedsModeration){ if($comment->NeedsModeration){

View File

@ -115,7 +115,7 @@ class Comment extends DataObject {
$labels['Name'] = _t('Comment.NAME', 'Author Name'); $labels['Name'] = _t('Comment.NAME', 'Author Name');
$labels['Comment'] = _t('Comment.COMMENT', 'Comment'); $labels['Comment'] = _t('Comment.COMMENT', 'Comment');
$labels['IsSpam'] = _t('Comment.ISSPAM', 'Spam?'); $labels['IsSpam'] = _t('Comment.ISSPAM', 'Spam?');
$labels['NeedsModeration'] = _t('Comment.NEEDSMODERATION', 'Needs Moderation?'); $labels['Moderated'] = _t('Comment.MODERATED', 'Moderated?');
return $labels; return $labels;
} }

View File

@ -0,0 +1,3 @@
<div class="pending-comment">
<p><% _t('AWAITINGMODERATION', 'Your comment has been submitted and is now awaiting moderation.') %></p>
</div>