mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
derp
This commit is contained in:
@@ -190,7 +190,7 @@ SocketTopics.markAsUnreadForAll = function(socket, tids, callback) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
db.sortedSetAdd('topics:recent', Date.now(), tid, function(err) {
|
||||
topics.updateRecent(tid, Date.now(), function(err) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
@@ -470,11 +470,6 @@ var async = require('async'),
|
||||
});
|
||||
};
|
||||
|
||||
Topics.updateTimestamp = function(tid, timestamp) {
|
||||
db.sortedSetAdd('topics:recent', timestamp, tid);
|
||||
Topics.setTopicField(tid, 'lastposttime', timestamp);
|
||||
};
|
||||
|
||||
Topics.getUids = function(tid, callback) {
|
||||
Topics.getPids(tid, function(err, pids) {
|
||||
if (err) {
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = function(Topics) {
|
||||
Topics.setTopicField(tid, 'deleted', 1, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetRemove('topics:recent', tid, next);
|
||||
Topics.removeRecent(tid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetRemove('topics:posts', tid, next);
|
||||
@@ -69,7 +69,7 @@ module.exports = function(Topics) {
|
||||
Topics.setTopicField(tid, 'deleted', 0, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetAdd('topics:recent', topicData.lastposttime, tid, next);
|
||||
Topics.updateRecent(tid, topicData.lastposttime, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetAdd('topics:posts', topicData.postcount, tid, next);
|
||||
@@ -99,7 +99,7 @@ module.exports = function(Topics) {
|
||||
db.sortedSetRemove('topics:tid', tid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetRemove('topics:recent', tid, next);
|
||||
Topics.removeRecent(tid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetRemove('topics:posts', tid, next);
|
||||
|
||||
@@ -33,4 +33,17 @@ module.exports = function(Topics) {
|
||||
db.getSortedSetRevRangeByScore('topics:recent', start, count, Infinity, Date.now() - since, callback);
|
||||
};
|
||||
|
||||
Topics.updateTimestamp = function(tid, timestamp) {
|
||||
Topics.updateRecent(tid, timestamp);
|
||||
Topics.setTopicField(tid, 'lastposttime', timestamp);
|
||||
};
|
||||
|
||||
Topics.updateRecent = function(tid, timestamp, callback) {
|
||||
callback = callback || function() {};
|
||||
db.sortedSetAdd('topics:recent', timestamp, tid, callback);
|
||||
};
|
||||
|
||||
Topics.removeRecent = function(tid, callback) {
|
||||
db.sortedSetRemove('topics:recent', tid, callback);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user