Index: comment.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v
retrieving revision 1.1
diff -u -r1.1 comment.admin.inc
--- comment.admin.inc	31 Oct 2007 17:50:47 -0000	1.1
+++ comment.admin.inc	19 Nov 2007 05:34:44 -0000
@@ -219,11 +219,29 @@
 function comment_confirm_delete(&$form_state, $comment) {
   $form = array();
   $form['#comment'] = $comment;
+
+  $descendants = array();
+  _comment_descendants($comment, &$descendants);
+
+  if (empty($descendants)) {
+    $description = t('This action cannot be undone');
+  }
+  else {
+    $description = t("Following replies to this comment will also be deleted. This action cannot be undone.");
+    $item = array();
+    $node = node_load(array('nid' => $comment->nid));
+    foreach ($descendants as $c) {
+      $basepath = base_path();
+      $item[] = '<a href='. $basepath . 'node/'. $node->nid .'/#comment-'. $c->cid .'>'. $c->subject .'</a> by '. theme('username', user_load(array('uid' => $c->uid)));
+    }
+    $description .= theme('item_list', $item);
+  }
+
   return confirm_form(
     $form,
     t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)),
     'node/'. $comment->nid,
-    t('Any replies to this comment will be lost. This action cannot be undone.'),
+    $description,
     t('Delete'),
     t('Cancel'),
     'comment_confirm_delete');
@@ -265,3 +283,16 @@
     _comment_delete_thread($comment);
   }
 }
+
+/**
+ * Get all replies (including descendants down in the tree) to a comment.
+ * @$comment: comment
+ * @$descendants: array of all descendant comments
+ */
+function _comment_descendants($comment, &$descendants = array()) {
+  $result = db_query('SELECT c.* FROM {comments} c WHERE pid = %d', $comment->cid);
+  while ($child = db_fetch_object($result)) {
+    array_push($descendants, $child);
+    _comment_descendants($child, &$descendants);
+  }
+}
