mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX: redirect user down to their posted comment if it was not posted via AJAX
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@73016 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5e5a06d8e9
commit
6b0ab830dd
@ -287,7 +287,16 @@ class PageCommentInterface_Form extends Form {
|
||||
echo $comment->renderWith('PageCommentInterface_singlecomment');
|
||||
}
|
||||
} else {
|
||||
Director::redirectBack();
|
||||
// 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(Director::baseURL(). $page->URLSegment.'#PageComment_'.$comment->ID);
|
||||
}
|
||||
}
|
||||
return Director::redirectBack(); // worst case, just go back to the page
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user