Commit ef5d9d89 authored by catch's avatar catch

Issue #1313300 by jwilson3, rjgoldsborough, MrHaroldA: Fixed Wrong uri in 'Add...

Issue #1313300 by jwilson3, rjgoldsborough, MrHaroldA: Fixed Wrong uri in 'Add new comment' teaser link if set to COMMENT_FORM_BELOW.
parent b059099e
......@@ -667,13 +667,17 @@ function comment_node_view($node, $view_mode) {
}
}
if ($node->comment == COMMENT_NODE_OPEN) {
$comment_form_location = variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW);
if (user_access('post comments')) {
$links['comment-add'] = array(
'title' => t('Add new comment'),
'href' => "comment/reply/$node->nid",
'href' => "node/$node->nid",
'attributes' => array('title' => t('Add a new comment to this page.')),
'fragment' => 'comment-form',
);
if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {
$links['comment-add']['href'] = "comment/reply/$node->nid";
}
}
else {
$links['comment-forbidden'] = array(
......
......@@ -920,6 +920,17 @@ class CommentInterfaceTest extends CommentHelperCase {
}
else {
$this->assertLink('Add new comment');
// Verify that the "Add new comment" link points to the correct URL
// based on the comment form location configuration.
if ($info['form'] == COMMENT_FORM_SEPARATE_PAGE) {
$this->assertLinkByHref("comment/reply/$nid#comment-form", 0, 'Comment form link destination is on a separate page.');
$this->assertNoLinkByHref("node/$nid#comment-form");
}
else {
$this->assertLinkByHref("node/$nid#comment-form", 0, 'Comment form link destination is on node.');
$this->assertNoLinkByHref("comment/reply/$nid#comment-form");
}
}
// Also verify that the comment form appears according to the configured
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment