diff --git a/public/templates/category.tpl b/public/templates/category.tpl
index b0bf52d5a3..4bda45c74f 100644
--- a/public/templates/category.tpl
+++ b/public/templates/category.tpl
@@ -21,9 +21,9 @@
-
3 {topics.title} 24
+
{topics.post_count} {topics.title} 24
Posted {topics.relativeTime} ago by
- {topics.username}. {topics.post_count} posts.
+
{topics.username}.
diff --git a/src/posts.js b/src/posts.js
index 0c92061829..c85da614e6 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -2,6 +2,7 @@ var RDB = require('./redis.js'),
utils = require('./utils.js'),
marked = require('marked'),
user = require('./user.js'),
+ topics = require('./topics.js'),
config = require('../config.js');
(function(Posts) {
@@ -12,6 +13,7 @@ var RDB = require('./redis.js'),
var post_data, user_data, thread_data, vote_data, viewer_data;
+ topics.markAsRead(tid, current_user);
//compile thread after all data is asynchronously called
function generateThread() {
@@ -123,6 +125,8 @@ var RDB = require('./redis.js'),
if (pid > 0) {
RDB.rpush('tid:' + tid + ':posts', pid);
+ RDB.del('tid:' + tid + ':read_by_uid'); // let everybody know there is an unread post
+
socket.emit('event:alert', {
title: 'Reply Successful',
message: 'You have successfully replied. Click here to view your reply.',
diff --git a/src/topics.js b/src/topics.js
index 89e6c9ab26..54911f672d 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -12,8 +12,7 @@ var RDB = require('./redis.js'),
}
-
- Topics.get = function(callback, category_id, start, end) {
+ Topics.get = function(callback, category_id, current_user, start, end) {
if (start == null) start = 0;
if (end == null) end = start + 10;
@@ -70,15 +69,18 @@ var RDB = require('./redis.js'),
locked = replies[6];
deleted = replies[7];
pinned = replies[8];
-
- user.get_usernames_by_uids(uid, function(userNames) {
-
- for (var i=0, ii=title.length; i