Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.713
diff -u -p -r1.713 comment.module
--- modules/comment/comment.module	25 May 2009 15:43:38 -0000	1.713
+++ modules/comment/comment.module	28 May 2009 00:33:37 -0000
@@ -419,11 +419,13 @@ function comment_node_view($node, $tease
 
   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.
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.29
diff -u -p -r1.29 comment.test
--- modules/comment/comment.test	24 May 2009 17:39:31 -0000	1.29
+++ modules/comment/comment.test	28 May 2009 00:33:38 -0000
@@ -618,10 +618,17 @@ class CommentRSSUnitTest extends Comment
    * 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.'));
   }
 }
