This commit is contained in:
barisusakli
2014-03-17 17:27:42 -04:00
parent ef97f627f4
commit 8efc33d6a1
4 changed files with 29 additions and 18 deletions

View File

@@ -21,7 +21,8 @@ var async = require('async'),
notifications = require('./notifications'),
favourites = require('./favourites'),
meta = require('./meta'),
Plugins = require('./plugins');
Plugins = require('./plugins'),
emitter = require('./emitter');
(function(Topics) {
@@ -1015,12 +1016,14 @@ var async = require('async'),
Topics.setTopicField(tid, 'lastposttime', timestamp);
};
Topics.onNewPostMade = function(tid, pid, timestamp, callback) {
Topics.increasePostCount(tid);
Topics.updateTimestamp(tid, timestamp);
Topics.addPostToTopic(tid, pid, timestamp, callback);
Topics.onNewPostMade = function(postData) {
Topics.increasePostCount(postData.tid);
Topics.updateTimestamp(postData.tid, postData.timestamp);
Topics.addPostToTopic(postData.tid, postData.pid, postData.timestamp);
};
emitter.on('newpost', Topics.onNewPostMade);
Topics.addPostToTopic = function(tid, pid, timestamp, callback) {
db.sortedSetAdd('tid:' + tid + ':posts', timestamp, pid, callback);
};