Commit 033f2f3f authored by Dries's avatar Dries
Browse files

- Patch #335893 by andypost, hexmode: don't show comment information in the...

- Patch #335893 by andypost, hexmode: don't show comment information in the RSS feed when a node's comments were disabled.
parent 2cb8fb68
......@@ -420,11 +420,13 @@ function comment_node_view($node, $teaser) {
if ($node->comment) {
if ($node->build_mode == NODE_BUILD_RSS) {
// Add a comments RSS element which is a URL to the comments of this node.
$node->rss_elements[] = array(
'key' => 'comments',
'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))
);
if ($node->comment != COMMENT_NODE_HIDDEN) {
// Add a comments RSS element which is a URL to the comments of this node.
$node->rss_elements[] = array(
'key' => 'comments',
'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))
);
}
}
else if ($teaser) {
// Main page: display the number of comments that have been posted.
......
......@@ -618,10 +618,17 @@ class CommentRSSUnitTest extends CommentHelperCase {
* Test comments as part of an RSS feed.
*/
function testCommentRSS() {
// Find comment in RSS feed.
$this->drupalLogin($this->web_user);
$comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
$this->drupalGet('rss.xml');
$raw = '<comments>' . url('node/' . $this->node->nid, array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
$this->assertRaw($raw, t('Comments as part of RSS feed.'));
// Hide comments from RSS feed and check presence.
$this->node->comment = COMMENT_NODE_HIDDEN;
node_save($this->node);
$this->drupalGet('rss.xml');
$this->assertNoRaw($raw, t('Hidden comments is not a part of RSS feed.'));
}
}
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