mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
dont add tid to :tids:posts if its pinned
This commit is contained in:
@@ -111,7 +111,7 @@ module.exports = function (Categories) {
|
|||||||
|
|
||||||
Categories.onNewPostMade = function (cid, pinned, postData, callback) {
|
Categories.onNewPostMade = function (cid, pinned, postData, callback) {
|
||||||
if (!cid || !postData) {
|
if (!cid || !postData) {
|
||||||
return callback();
|
return setImmediate(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
async.parallel([
|
async.parallel([
|
||||||
@@ -123,17 +123,23 @@ module.exports = function (Categories) {
|
|||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
if (parseInt(pinned, 10) === 1) {
|
if (parseInt(pinned, 10) === 1) {
|
||||||
next();
|
return setImmediate(next);
|
||||||
} else {
|
|
||||||
db.sortedSetAdd('cid:' + cid + ':tids', postData.timestamp, postData.tid, next);
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
async.parallel([
|
||||||
function (next) {
|
function (next) {
|
||||||
Categories.updateRecentTid(cid, postData.tid, next);
|
db.sortedSetAdd('cid:' + cid + ':tids', postData.timestamp, postData.tid, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
db.sortedSetIncrBy('cid:' + cid + ':tids:posts', 1, postData.tid, next);
|
db.sortedSetIncrBy('cid:' + cid + ':tids:posts', 1, postData.tid, next);
|
||||||
}
|
}
|
||||||
|
], function (err) {
|
||||||
|
next(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function (next) {
|
||||||
|
Categories.updateRecentTid(cid, postData.tid, next);
|
||||||
|
}
|
||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -184,13 +184,13 @@ module.exports = function (Topics) {
|
|||||||
async.parallel([
|
async.parallel([
|
||||||
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:pinned', Date.now(), tid),
|
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:pinned', Date.now(), tid),
|
||||||
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids', tid),
|
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids', tid),
|
||||||
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:posts', tid),
|
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:posts', tid)
|
||||||
], next);
|
], next);
|
||||||
} else {
|
} else {
|
||||||
async.parallel([
|
async.parallel([
|
||||||
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:pinned', tid),
|
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:pinned', tid),
|
||||||
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids', topicData.lastposttime, tid),
|
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids', topicData.lastposttime, tid),
|
||||||
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:posts', topicData.postcount, tid),
|
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:posts', topicData.postcount, tid)
|
||||||
], next);
|
], next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user