From 1427ae3523c3be2b03ef1c664a4e710a0aaed0fd Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 15 Oct 2010 02:32:38 +0000 Subject: [PATCH] BUGFIX: if moderation on comments is enabled then redirect the user back down to the comment section to view the message rather than trying to direct to selector which doesnt exist (from r105514) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112479 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageCommentInterface.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index cacc6a8d..d1c4e7a0 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -343,13 +343,15 @@ class PageCommentInterface_Form extends Form { if($comment->NeedsModeration){ $this->sessionMessage($moderationMsg, 'good'); } - // since it is not ajax redirect user down to their comment since it has been posted - // get the pages url off the comments parent ID. + if($comment->ParentID) { $page = DataObject::get_by_id("Page", $comment->ParentID); if($page) { - // Redirect to the actual post on the page. - return Director::redirect($page->Link() . '#PageComment_' . $comment->ID); + // if it needs moderation then it won't appear in the list. Therefore + // we need to link to the comment holder rather than the individual comment + $url = ($comment->NeedsModeration) ? $page->Link() . '#PageComments_holder' : $page->Link() . '#PageComment_' . $comment->ID; + + return Director::redirect($url); } } @@ -374,4 +376,4 @@ class PageCommentInterface_Controller extends ContentController { } } -?> +?> \ No newline at end of file