summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/forum/forum.module8
-rw-r--r--modules/forum/forum.test10
2 files changed, 14 insertions, 4 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 61b68c863..601f4d534 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -463,7 +463,7 @@ function forum_field_storage_pre_update($obj_type, $object, &$skip_fields) {
foreach ($language as $delta) {
$query->values(array(
'nid' => $object->nid,
- 'title' => $object->title,
+ 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
'tid' => $delta['value'],
'sticky' => $object->sticky,
'created' => $object->created,
@@ -1107,14 +1107,14 @@ function _forum_update_forum_index($nid) {
if ($count > 0) {
// Comments exist.
- $last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(
+ $last_reply = db_query_range('SELECT cid, name, created, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', 0, 1, array(
':nid' => $nid,
':status' => COMMENT_PUBLISHED,
- ), 0, 1)->fetchObject();
+ ))->fetchObject();
db_update('forum_index')
->fields( array(
'comment_count' => $count,
- 'last_comment_timestamp' => $last_reply->timestamp,
+ 'last_comment_timestamp' => $last_reply->created,
))
->condition('nid', $nid)
->execute();
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index cf430b9e5..ab50e1e04 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -75,6 +75,16 @@ class ForumTestCase extends DrupalWebTestCase {
$this->createForumTopic($this->forum, FALSE);
$this->createForumTopic($this->forum, FALSE);
$this->drupalGet('node');
+
+ // Test adding a comment to a forum topic.
+ $node = $this->createForumTopic($this->forum, FALSE);
+ $this->drupalPost("node/$node->nid", array('comment' => $this->randomName()), t('Save'));
+ $this->assertResponse(200);
+
+ // Test editing a forum topic that has a comment.
+ $this->drupalLogin($this->any_user);
+ $this->drupalPost("node/$node->nid/edit", array(), t('Save'));
+ $this->assertResponse(200);
}
/**