From a3328641e7e12bb11f937c94fe256f5cf5e8fa9c Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sun, 22 Jul 2012 13:50:17 +1200 Subject: [PATCH] FIX: use template for storing pending comment message. --- code/controllers/CommentingController.php | 10 ++++------ code/dataobjects/Comment.php | 2 +- templates/CommentsInterface_pendingcomment.ss | 3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 templates/CommentsInterface_pendingcomment.ss diff --git a/code/controllers/CommentingController.php b/code/controllers/CommentingController.php index 71f3661..c042c60 100644 --- a/code/controllers/CommentingController.php +++ b/code/controllers/CommentingController.php @@ -357,19 +357,17 @@ class CommentingController extends Controller { $comment->Moderated = ($moderated) ? false : true; $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 Cookie::set('CommentsForm_Comment', false); if(Director::is_ajax()) { - if($comment->NeedsModeration){ - echo $moderationMsg; - } else{ + if(!$comment->Moderated) { + echo $comment->renderWith('CommentInterface_pendingcomment'); + } else { echo $comment->renderWith('CommentInterface_singlecomment'); } - return false; + return true; } if($comment->NeedsModeration){ diff --git a/code/dataobjects/Comment.php b/code/dataobjects/Comment.php index 4e1f638..c5d8f2e 100755 --- a/code/dataobjects/Comment.php +++ b/code/dataobjects/Comment.php @@ -115,7 +115,7 @@ class Comment extends DataObject { $labels['Name'] = _t('Comment.NAME', 'Author Name'); $labels['Comment'] = _t('Comment.COMMENT', 'Comment'); $labels['IsSpam'] = _t('Comment.ISSPAM', 'Spam?'); - $labels['NeedsModeration'] = _t('Comment.NEEDSMODERATION', 'Needs Moderation?'); + $labels['Moderated'] = _t('Comment.MODERATED', 'Moderated?'); return $labels; } diff --git a/templates/CommentsInterface_pendingcomment.ss b/templates/CommentsInterface_pendingcomment.ss new file mode 100644 index 0000000..3312d42 --- /dev/null +++ b/templates/CommentsInterface_pendingcomment.ss @@ -0,0 +1,3 @@ +
+

<% _t('AWAITINGMODERATION', 'Your comment has been submitted and is now awaiting moderation.') %>

+
\ No newline at end of file