summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcatch2012-02-20 07:30:57 (GMT)
committercatch2012-02-20 07:30:57 (GMT)
commitef5d9d89b311cc96adbfffc4f227284e5d4e37e2 (patch)
tree8034aabb5cbeac2b3c6037ed67a3ea8097e95efa
parentb059099e560c4f3b90b56127d31aff21e1e6c506 (diff)
Issue #1313300 by jwilson3, rjgoldsborough, MrHaroldA: Fixed Wrong uri in 'Add new comment' teaser link if set to COMMENT_FORM_BELOW.
-rw-r--r--core/modules/comment/comment.module6
-rw-r--r--core/modules/comment/comment.test11
2 files changed, 16 insertions, 1 deletions
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index bada6ed..02b7906 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -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(
diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test
index 5497dcc..ad7aa4f 100644
--- a/core/modules/comment/comment.test
+++ b/core/modules/comment/comment.test
@@ -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