Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.98
diff -u -r1.98 comment.test
--- modules/comment/comment.test	2 Jan 2011 23:54:05 -0000	1.98
+++ modules/comment/comment.test	5 Jan 2011 04:07:17 -0000
@@ -247,6 +247,54 @@
 
     return $match[2];
   }
+
+  /**
+   * Tests new comments markers.
+   */
+  public function testCommentNewCommentsIndicator() {
+    // Test if the right links are displayed when no comment is present for the node.
+    $this->drupalLogin($this->admin_user);
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN));
+    $this->drupalGet('node');
+    $this->assertNoLink(t('@count comments', array('@count' => 0)));
+    $this->assertNoLink(t('@count new comments', array('@count' => 0)));
+    $this->assertLink(t('Read more'));
+    $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper'));
+    $this->assertTrue(count($count) == 1, t('One child found'));
+    // Create a comment via CRUD API functionality, since
+    // $this->postComment() relies on actual user permissions
+    $comment = (object) array(
+      'cid' => NULL,
+      'nid' => $this->node->nid,
+      'node_type' => $this->node->type,
+      'pid' => 0,
+      'uid' => $this->loggedInUser->uid,
+      'status' => COMMENT_PUBLISHED,
+      'subject' => $this->randomName(),
+      'hostname' => ip_address(),
+      'language' => LANGUAGE_NONE,
+      'comment_body' => array(LANGUAGE_NONE => array($this->randomName())),
+    );
+    comment_save($comment);
+    $this->drupalLogout();
+
+    // Login whith web user and check links.
+    $this->drupalLogin($this->web_user);
+    $this->drupalGet('node');
+    $this->assertLink(t('1 new comment'));
+    $this->clickLink(t('1 new comment'));
+    $this->assertRaw('<span class="marker">' . t('new') . '</span>', t('Found "new" marker.'));
+    $this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), t('The "new" anchor is positioned at the right comment.'));
+
+    // Test if "new comment" link is correctly removed.
+    $this->drupalGet('node');
+    $this->assertLink(t('1 comment'));
+    $this->assertLink(t('Read more'));
+    $this->assertNoLink(t('1 new comment'));
+    $this->assertNoLink(t('@count new comments', array('@count' => 0)));
+    $count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper'));
+    $this->assertTrue(count($count) == 2, print_r($count, TRUE));
+  }
 }
 
 class CommentInterfaceTest extends CommentHelperCase {
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.931
diff -u -r1.931 comment.module
--- modules/comment/comment.module	2 Jan 2011 23:54:05 -0000	1.931
+++ modules/comment/comment.module	5 Jan 2011 04:07:16 -0000
@@ -1702,7 +1702,7 @@
     // Setup standard comment properties.
     foreach ($comments as $key => $comment) {
       $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-      $comment->new = node_mark($comment->nid, $comment->changed);
+      $comment->new = comment_mark($comment->nid, $comment->changed, $comment->created);
       $comment->node_type = 'comment_node_' . $comment->node_type;
       $comments[$key] = $comment;
     }
@@ -1711,6 +1711,36 @@
 }
 
 /**
+ * Decide on the type of marker to be displayed for a comment of a given node.
+ *
+ * @param $nid
+ *   Comment's node ID whose history supplies the "last viewed" timestamp.
+ * @param $changed
+ *   Time when the comment was last updated, which is compared against node's "last viewed" timestamp.
+ * @param $created
+ *   Time when the comment was created, which is compared against node's "last viewed" timestamp.
+ * @return
+ *   One of the MARK constants.
+ */
+function comment_mark($nid, $changed, $created) {
+  global $user;
+  if (!$user->uid) {
+    return MARK_READ;
+  }
+
+  $timestamp = node_last_viewed($nid);
+  // Use same logic as comment_num_new to ensure consistent counts.
+  $timestamp = ($timestamp > NODE_NEW_LIMIT ? $timestamp : NODE_NEW_LIMIT);
+  if ($created > $timestamp) {
+    return MARK_NEW;
+  }
+  elseif ($changed > $timestamp) {
+    return MARK_UPDATED;
+  }
+  return MARK_READ;
+}
+
+/**
  * Get number of new comments for current user and specified node.
  *
  * @param $nid
@@ -2270,7 +2300,7 @@
   $variables['created']   = format_date($comment->created);
   $variables['changed']   = format_date($comment->changed);
 
-  $variables['new']       = !empty($comment->new) ? t('new') : '';
+  $variables['new']       = !empty($comment->new) ? theme('mark', array('type' => $comment->new)) : '';
   $variables['picture']   = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : '';
   $variables['signature'] = $comment->signature;
 
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1336
diff -u -r1.1336 node.module
--- modules/node/node.module	3 Jan 2011 18:03:54 -0000	1.1336
+++ modules/node/node.module	5 Jan 2011 04:07:18 -0000
@@ -1403,11 +1403,13 @@
     drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
   }
 
+  // For markup consistency with other pages, use node_view_multiple() rather than node_view().
+  $nodes = node_view_multiple(array($node->nid => $node), 'full');
+
   // Update the history table, stating that this user viewed this node.
   node_tag_new($node);
 
-  // For markup consistency with other pages, use node_view_multiple() rather than node_view().
-  return node_view_multiple(array($node->nid => $node), 'full');
+  return $nodes;
 }
 
 /**
