Skip to content

Node.js based forum software built for the modern web

fixed live tiles if there are more than 2 posts

Baris Soner Usakli9320883f92a9
diff --git a/src/categories.js b/src/categories.js
index fb5cdeac12..1ff42a7304 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -277,7 +277,7 @@ var RDB = require('./redis.js'),
}
Categories.getRecentReplies = function(cid, count, callback) {
- RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count, function(err, pids) {
+ RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count-1, function(err, pids) {
if (pids.length == 0) {
callback([]);
diff --git a/src/webserver.js b/src/webserver.js
index 1c57b732d0..e6a346944a 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -192,7 +192,7 @@ var express = require('express'),
function iterator(category, callback) {
categories.getRecentReplies(category.cid, 2, function(posts) {
category["posts"] = posts;
- category["post_count"] = posts.length;
+ category["post_count"] = posts.length>2 ? 2 : posts.length;
callback(null);
});
}