From 285e19fbbfcc1b6d5bad55ae800f40583b14ba08 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 18 Jul 2013 15:14:06 -0400 Subject: [PATCH] closes #97 --- src/postTools.js | 4 ++++ src/posts.js | 6 ++---- src/topics.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/postTools.js b/src/postTools.js index a0e5f72ebd..7759f7ef60 100644 --- a/src/postTools.js +++ b/src/postTools.js @@ -95,6 +95,10 @@ marked.setOptions({ threadTools.delete(tid, -1, function(err) { if (err) console.log('Error: Could not delete topic (tid: ' + tid + ')'); }); + } else { + posts.getPostField(pid, 'timestamp', function(timestamp) { + topics.updateTimestamp(tid, timestamp); + }); } }); }); diff --git a/src/posts.js b/src/posts.js index 9250f37ba5..2cdb50e61e 100644 --- a/src/posts.js +++ b/src/posts.js @@ -297,7 +297,7 @@ marked.setOptions({ topics.increasePostCount(tid); topics.setTopicField(tid, 'lastposttime', timestamp); - topics.addToRecent(tid, timestamp); + topics.updateTimestamp(tid, timestamp); RDB.incr('totalpostcount'); @@ -316,9 +316,7 @@ marked.setOptions({ RDB.sadd('cid:' + cid + ':active_users', uid); }); - }); - - + }); user.onNewPostMade(uid, tid, pid, timestamp); diff --git a/src/topics.js b/src/topics.js index e613e521d6..bb53236273 100644 --- a/src/topics.js +++ b/src/topics.js @@ -450,7 +450,7 @@ marked.setOptions({ }); } - Topics.addToRecent = function(tid, timestamp) { + Topics.updateTimestamp = function(tid, timestamp) { RDB.zadd(schema.topics().recent, timestamp, tid); }