summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-09-13 14:12:07 +0000
committerDries Buytaert <dries@buytaert.net>2009-09-13 14:12:07 +0000
commitf8c8827b2416ad6d8b0a1beb4a58db66032a7508 (patch)
treef0ca9a3b38190b5ae38976ad18cf1a4b5c0cbd5a
parent0e7888168169195787cf9b2cb2f7dd823681db14 (diff)
downloadbrdo-f8c8827b2416ad6d8b0a1beb4a58db66032a7508.tar.gz
brdo-f8c8827b2416ad6d8b0a1beb4a58db66032a7508.tar.bz2
- Patch #554164 by mfb: fixed bug with forum topic counts and added tests.
-rw-r--r--modules/forum/forum.module2
-rw-r--r--modules/forum/forum.test5
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index e61d47be7..b88e04928 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -623,7 +623,7 @@ function forum_get_forums($tid = 0) {
if (count($_forums)) {
$query = db_select('node', 'n');
$query->join('node_comment_statistics', 'ncs', 'n.nid = ncs.nid');
- $query->join('forum', 'f', 'f.vid = f.vid');
+ $query->join('forum', 'f', 'n.vid = f.vid');
$query->addExpression('COUNT(n.nid)', 'topic_count');
$query->addExpression('SUM(ncs.comment_count)', 'comment_count');
$counts = $query
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 9da887f56..9faaad0f0 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -63,6 +63,11 @@ class ForumTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->any_user);
// Verify the any forum user has access to all the forum nodes.
$this->verifyForums($this->own_user, $node, TRUE);
+
+ // Verify the topic and post counts on the forum page.
+ $this->drupalGet('forum');
+ $this->assertRaw("<td class=\"topics\">\n 6 </td>");
+ $this->assertRaw('<td class="posts">6</td>');
}
/**