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
This commit is contained in:
Ingo Schommer 2010-10-15 02:32:38 +00:00
parent d3ebd0da22
commit 1427ae3523

View File

@ -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 {
}
}
?>
?>