Index: modules/comment/comment.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v
retrieving revision 1.31
diff -u -p -r1.31 comment.admin.inc
--- modules/comment/comment.admin.inc	25 Aug 2009 10:27:14 -0000	1.31
+++ modules/comment/comment.admin.inc	3 Sep 2009 11:26:03 -0000
@@ -59,7 +59,6 @@ function comment_admin_overview($type = 
   // Load the comments that need to be displayed.
   $status = ($arg == 'approval') ? COMMENT_NOT_PUBLISHED : COMMENT_PUBLISHED;
   $header = array(
-    'subject' => array('data' => t('Subject'), 'field' => 'subject'),
     'author' => array('data' => t('Author'), 'field' => 'name'),
     'posted_in' => array('data' => t('Posted in'), 'field' => 'node_title'),
     'time' => array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
@@ -86,9 +85,8 @@ function comment_admin_overview($type = 
 
   foreach ($result as $comment) {
     $options[$comment->cid] = array(
-      'subject' => l($comment->subject, 'comment/' . $comment->cid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid)),
       'author' => theme('username', $comment),
-      'posted_in' => l($comment->node_title, 'node/' . $comment->nid),
+      'posted_in' => l($comment->node_title, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)),
       'time' => format_date($comment->timestamp, 'short'),
       'operations' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination)),
     );
@@ -140,7 +138,7 @@ function comment_admin_overview_submit($
         // Allow modules to respond to the updating of a comment.
         module_invoke_all('comment_' . $form_state['values']['operation'], $comment);
         // Add an entry to the watchdog log.
-        watchdog('content', 'Comment: updated %subject.', array('%subject' => $comment->subject), WATCHDOG_NOTICE, l(t('view'), 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)));
+        watchdog('content', 'Comment: updated %cid.', array('%cid' => $comment->cid), WATCHDOG_NOTICE, l(t('view'), 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)));
       }
     }
     cache_clear_all();
@@ -237,7 +235,7 @@ function comment_confirm_delete(&$form_s
   $form['#comment'] = $comment;
   return confirm_form(
     $form,
-    t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)),
+    t('Are you sure you want to delete the comment by %name', array('%name' => $comment->name)),
     'node/' . $comment->nid,
     t('Any replies to this comment will be lost. This action cannot be undone.'),
     t('Delete'),
Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.44
diff -u -p -r1.44 comment.install
--- modules/comment/comment.install	9 Aug 2009 02:46:27 -0000	1.44
+++ modules/comment/comment.install	3 Sep 2009 11:26:03 -0000
@@ -12,6 +12,31 @@
 function comment_install() {
   // Create tables.
   drupal_install_schema('comment');
+
+  // Create comment body field.
+  $field = array(
+    'field_name' => 'comment_body',
+    'type' => 'text_long',
+  );
+  field_create_field($field);
+
+  // Attach the body field to all existing comment bundles.
+  $instance = array(
+    'label' => 'Body',
+    'field_name' => 'comment_body',
+    'settings' => array('text_processing' => 1),
+  );
+  foreach (node_type_get_types() as $info) {
+    $instance['bundle'] = 'comment_node_' . $info->type;
+    field_create_instance($instance);
+  }
+
+  // Create comment subject field.
+  $field = array(
+    'field_name' => 'comment_subject',
+    'type' => 'text',
+  );
+  field_create_field($field);
 }
 
 /**
@@ -21,6 +46,15 @@ function comment_uninstall() {
   // Remove tables.
   drupal_uninstall_schema('comment');
 
+  // @TODO do we need to check if any non-comment bundle has these fields
+  // assigned before deleting? If so, what happens then?
+
+  // Delete comment_body field.
+  field_delete_field('comment_body');
+
+  // Delete comment_subject field.
+  field_delete_field('comment_subject');
+
   // Remove variables.
   variable_del('comment_block_count');
   $node_types = array_keys(node_type_get_types());
@@ -160,6 +194,55 @@ function comment_update_7006() {
 }
 
 /**
+ * Create the comment_body and comment_subject fields.
+ */
+function comment_update_7007() {
+  // Create comment body field.
+  $field = array(
+    'field_name' => 'comment_body',
+    'type' => 'text_long',
+  );
+  field_create_field($field);
+
+  // Create comment_subject field.
+  $field = array(
+    'field_name' => 'comment_subject',
+    'type' => 'text',
+  );
+  field_create_field($field);
+
+  // Add the fields to comments for all existing bundles.
+  $body_instance = array(
+    'field_name' => 'comment_body',
+    'label' => 'Body',
+    'settings' => array('text_processing' => 1),
+  );
+  $subject_instance = array(
+    'field_name' => 'comment_subject',
+    'label' => 'Subject',
+  );
+  foreach (node_type_get_types() as $info) {
+    $body_instance['bundle'] = 'comment_node_' . $info->type;
+    field_create_instance($body_instance);
+
+    // Only create the subject field if it is enabled for this content type.
+    if (variable_get('comment_subject_field_' . $info->type, TRUE)) {
+      $subject_instance['bundle'] = 'comment_node_' . $info->type;
+      field_create_instance($subject_instance);
+      variable_del('comment_subject_field_' . $info->type);
+    }
+  }
+  return array();
+}
+
+/**
+ * Migrate comment body and subject data to field tables.
+ */
+function comment_update_7008() {
+  // @todo- probably an INSERT INTO SELECT FROM.
+}
+
+/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
@@ -194,19 +277,6 @@ function comment_schema() {
         'default' => 0,
         'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.',
       ),
-      'subject' => array(
-        'type' => 'varchar',
-        'length' => 64,
-        'not null' => TRUE,
-        'default' => '',
-        'description' => 'The comment title.',
-      ),
-      'comment' => array(
-        'type' => 'text',
-        'not null' => TRUE,
-        'size' => 'big',
-        'description' => 'The comment body.',
-      ),
       'hostname' => array(
         'type' => 'varchar',
         'length' => 128,
@@ -228,13 +298,6 @@ function comment_schema() {
         'size' => 'tiny',
         'description' => 'The published status of a comment. (0 = Not Published, 1 = Published)',
       ),
-      'format' => array(
-        'type' => 'int',
-        'size' => 'small',
-        'not null' => TRUE,
-        'default' => 0,
-        'description' => 'The {filter_format}.format of the comment body.',
-      ),
       'thread' => array(
         'type' => 'varchar',
         'length' => 255,
@@ -321,4 +384,4 @@ function comment_schema() {
   );
 
   return $schema;
-}
\ No newline at end of file
+}
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.765
diff -u -p -r1.765 comment.module
--- modules/comment/comment.module	29 Aug 2009 10:46:40 -0000	1.765
+++ modules/comment/comment.module	3 Sep 2009 11:26:04 -0000
@@ -223,6 +223,15 @@ function comment_menu() {
  */
 function comment_node_type_insert($info) {
   field_attach_create_bundle('comment_node_' . $info->type);
+
+  // Attach the body field by default.
+  $instance = array(
+    'field_name' => 'comment_body',
+    'label' =>'body',
+    'bundle' => 'comment_node_' . $info->type,
+    'settings' => array('text_processing' => 1),
+  );
+  field_create_instance($instance);
 }
 
 /**
@@ -244,7 +253,6 @@ function comment_node_type_delete($info)
     'comment_default_mode',
     'comment_default_per_page',
     'comment_anonymous',
-    'comment_subject_field',
     'comment_preview',
     'comment_form_location',
   );
@@ -387,11 +395,14 @@ function comment_get_recent($number = 10
     // Using Query Builder here for the IN-Statement.
     $query = db_select('comment', 'c');
     $query->innerJoin('node', 'n', 'n.nid = c.nid');
+    $query->innerJoin('users', 'u', 'u.uid = c.uid');
+    $query->addField('n', 'title', 'node_title');
     return $query
-      ->fields('c', array('nid', 'subject', 'cid', 'timestamp'))
+      ->fields('c', array('nid', 'cid', 'uid', 'timestamp'))
       ->condition('c.nid', $nids, 'IN')
       ->condition('c.status', COMMENT_PUBLISHED)
       ->condition('n.status', 1)
+      ->addExpression('IF(c.uid != 0, u.name, c.name)', 'name')
       ->orderBy('c.cid', 'DESC')
       ->range(0, $number)
       ->execute()
@@ -461,8 +472,9 @@ function comment_new_page_count($num_com
 function theme_comment_block() {
   $items = array();
   $number = variable_get('comment_block_count', 10);
+
   foreach (comment_get_recent($number) as $comment) {
-    $items[] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '<br />' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->timestamp)));
+    $items[] = theme('username', $comment) . t('on') .  l($comment->node_title, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)). '<br />' . t('@time ago', array('@time' => format_interval(REQUEST_TIME, $comment->timestamp)));
   }
 
   if ($items) {
@@ -821,11 +833,6 @@ function comment_build_content($comment,
     $comment->content = array();
   }
 
-  // Build comment body.
-  $comment->content['comment_body'] = array(
-    '#markup' => check_markup($comment->comment, $comment->format),
-  );
-
   $comment->content += field_attach_view('comment', $comment, $build_mode);
 
   if (empty($comment->in_preview)) {
@@ -975,11 +982,6 @@ function comment_form_node_type_form_alt
       $form['comment']['comment_anonymous']['#access'] = FALSE;
     }
 
-    $form['comment']['comment_subject_field'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Allow comment title'),
-      '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1),
-    );
     $form['comment']['comment_form_location'] = array(
       '#type' => 'checkbox',
       '#title' => t('Show reply form on the same page as comments'),
@@ -1128,17 +1130,7 @@ function comment_node_delete($node) {
  * Implement hook_node_update_index().
  */
 function comment_node_update_index($node) {
-  $text = '';
-  if ($node->comment != COMMENT_NODE_HIDDEN) {
-    $comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(
-      ':nid' => $node->nid,
-      ':status' => COMMENT_PUBLISHED
-    ));
-    foreach ($comments as $comment) {
-      $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format);
-    }
-  }
-  return $text;
+  $text = drupal_render(comment_node_page_additions($node));
 }
 
 /**
@@ -1255,9 +1247,6 @@ function comment_save($comment) {
       ->fields(array(
         'status' => $comment->status,
         'timestamp' => $comment->timestamp,
-        'subject' => $comment->subject,
-        'comment' => $comment->comment,
-        'format' => $comment->comment_format,
         'uid' => $comment->uid,
         'name' => $comment->name,
         'mail' => $comment->mail,
@@ -1269,7 +1258,7 @@ function comment_save($comment) {
     // Allow modules to respond to the updating of a comment.
     module_invoke_all('comment_update', $comment);
     // Add an entry to the watchdog log.
-    watchdog('content', 'Comment: updated %subject.', array('%subject' => $comment->subject), WATCHDOG_NOTICE, l(t('view'), 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)));
+    watchdog('content', 'Comment: updated %cid.', array('%subject' => $comment->cid), WATCHDOG_NOTICE, l(t('view'), 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)));
   }
   else {
     // Add the comment to database. This next section builds the thread field.
@@ -1326,9 +1315,6 @@ function comment_save($comment) {
         'nid' => $comment->nid,
         'pid' => empty($comment->pid) ? 0 : $comment->pid,
         'uid' => $comment->uid,
-        'subject' => $comment->subject,
-        'comment' => $comment->comment,
-        'format' => $comment->comment_format,
         'hostname' => ip_address(),
         'timestamp' => $comment->timestamp,
         'status' => $comment->status,
@@ -1440,6 +1426,7 @@ function comment_operations($action = NU
  *  An array of comment objects, indexed by comment ID.
  */
 function comment_load_multiple($cids = array(), $conditions = array()) {
+  dpm(entity_load('comment', $cids, $conditions));
   return entity_load('comment', $cids, $conditions);
 }
 
@@ -1482,6 +1469,7 @@ class CommentController extends DrupalDe
       $comment->node_type = 'comment_node_' . $comment->node_type;
       $comments[$key] = $comment;
     }
+    parent::attachLoad($comments);
   }
 }
 
@@ -1785,15 +1773,6 @@ function comment_form(&$form_state, $com
     );
   }
 
-  if (variable_get('comment_subject_field_' . $node->type, 1) == 1) {
-    $form['subject'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Subject'),
-      '#maxlength' => 64,
-      '#default_value' => !empty($comment->subject) ? $comment->subject : '',
-    );
-  }
-
   if (!empty($comment->comment)) {
     $default = $comment->comment;
   }
@@ -1801,15 +1780,6 @@ function comment_form(&$form_state, $com
     $default = '';
   }
 
-  $form['comment'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Comment'),
-    '#rows' => 15,
-    '#default_value' => $default,
-    '#text_format' => isset($comment->format) ? $comment->format : FILTER_FORMAT_DEFAULT,
-    '#required' => TRUE,
-  );
-
   $form['cid'] = array(
     '#type' => 'value',
     '#value' => !empty($comment->cid) ? $comment->cid : NULL,
@@ -1880,7 +1850,6 @@ function comment_preview($comment) {
   $node = node_load($comment->nid);
 
   if (!form_get_errors()) {
-    $comment->format = $comment->comment_format;
 
     // Attach the user and time information.
     if (!empty($comment->author)) {
@@ -2010,19 +1979,6 @@ function comment_submit($comment) {
     $comment['name'] = $comment['author'];
   }
 
-  // Validate the comment's subject. If not specified, extract from comment body.
-  if (trim($comment['subject']) == '') {
-    // The body may be in any format, so:
-    // 1) Filter it into HTML
-    // 2) Strip out all HTML tags
-    // 3) Convert entities back to plain-text.
-    $comment['subject'] = truncate_utf8(trim(decode_entities(strip_tags(check_markup($comment['comment'], $comment['comment_format'])))), 29, TRUE);
-    // Edge cases where the comment body is populated only by HTML tags will
-    // require a default subject.
-    if ($comment['subject'] == '') {
-      $comment['subject'] = t('(No subject)');
-    }
-  }
   return (object)$comment;
 }
 
@@ -2059,8 +2015,8 @@ function comment_form_submit($form, &$fo
     $redirect = array('comment/' . $comment->cid, array(), 'comment-' . $comment->cid);
   }
   else {
-    watchdog('content', 'Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject), WATCHDOG_WARNING);
-    drupal_set_message(t('Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%subject' => $comment->subject)), 'error');
+    watchdog('content', 'Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%title' => $node->title), WATCHDOG_WARNING);
+    drupal_set_message(t('Comment: unauthorized comment submitted or comment submitted to a closed post %subject.', array('%title' => $comment->title)), 'error');
     $page = comment_new_page_count($node->comment_count, 1, $node);
     $redirect = array('node/' . $node->nid, $page);
   }
@@ -2085,7 +2041,7 @@ function template_preprocess_comment(&$v
   $variables['new']       = !empty($comment->new) ? t('new') : '';
   $variables['picture']   = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '';
   $variables['signature'] = $comment->signature;
-  $variables['title']     = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid"));
+  $variables['title']     = isset($comment->comment_subject) ? l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid")) : '';
   $variables['template_files'][] = 'comment-' . $variables['node']->type;
   // Set status to a string representation of comment->status.
   if (isset($comment->in_preview)) {
@@ -2428,14 +2384,3 @@ function comment_menu_alter(&$items) {
   // Add comments to the description for admin/content.
   $items['admin/content']['description'] = "View, edit, and delete your site's content and comments.";
 }
-
-/**
- * Implement hook_filter_format_delete().
- */
-function comment_filter_format_delete($format, $default) {
-  db_update('comment')
-    ->fields(array('format' => $default->format))
-    ->condition('format', $format->format)
-    ->execute();
-}
-
Index: modules/comment/comment.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v
retrieving revision 1.24
diff -u -p -r1.24 comment.pages.inc
--- modules/comment/comment.pages.inc	1 Aug 2009 05:58:18 -0000	1.24
+++ modules/comment/comment.pages.inc	3 Sep 2009 11:26:04 -0000
@@ -109,7 +109,6 @@ function comment_approve($cid) {
   // Load the comment whose cid = $cid
   if ($comment = comment_load($cid)) {
     $comment->status = COMMENT_PUBLISHED;
-    $comment->comment_format = $comment->format;
     comment_save($comment);
 
     drupal_set_message(t('Comment approved.'));
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.44
diff -u -p -r1.44 comment.test
--- modules/comment/comment.test	21 Aug 2009 14:27:44 -0000	1.44
+++ modules/comment/comment.test	3 Sep 2009 11:26:04 -0000
@@ -28,8 +28,8 @@ class CommentHelperCase extends DrupalWe
    */
   function postComment($node, $subject, $comment, $preview = FALSE, $contact = NULL) {
     $edit = array();
-    $edit['subject'] = $subject;
-    $edit['comment'] = $comment;
+    $edit['comment_subject'] = $subject;
+    $edit['comment_body'] = $comment;
 
     if ($contact !== NULL && is_array($contact)) {
       $edit += $contact;
@@ -103,7 +103,17 @@ class CommentHelperCase extends DrupalWe
    *   Subject value.
    */
   function setCommentSubject($enabled) {
-    $this->setCommentSettings('comment_subject_field', ($enabled ? '1' : '0'), 'Comment subject ' . ($enabled ? 'enabled' : 'disabled') . '.');
+    $instance = array(
+      'field_name' => 'comment_subject',
+      'label' => 'Subject',
+      'bundle' => 'comment_node_article',
+    );
+    if ($enabled) {
+      field_create_instance($instance);
+    }
+    else {
+      field_delete_instance($instance['field_name'], $instance['bundle']);
+    }
   }
 
   /**
