mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 10:16:12 +01:00
clean up, radix
This commit is contained in:
@@ -81,13 +81,7 @@ module.exports = function(User) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function deletePosts(uid, callback) {
|
function deletePosts(uid, callback) {
|
||||||
db.getSortedSetRange('uid:' + uid + ':posts', 0, -1, function(err, pids) {
|
deleteSortedSetElements('uid:' + uid + ':posts', deletePost, callback);
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
async.each(pids, deletePost, callback);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletePost(pid, callback) {
|
function deletePost(pid, callback) {
|
||||||
@@ -196,11 +190,16 @@ module.exports = function(User) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteTopics(uid, callback) {
|
function deleteTopics(uid, callback) {
|
||||||
db.getSortedSetRange('uid:' + uid + ':topics', 0, -1, function(err, tids) {
|
deleteSortedSetElements('uid:' + uid + ':topics', deleteTopic, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSortedSetElements(set, deleteMethod, callback) {
|
||||||
|
db.getSortedSetRange(set, 0, -1, function(err, ids) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
async.each(tids, deleteTopic, callback);
|
|
||||||
|
async.each(ids, deleteMethod, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +252,7 @@ module.exports = function(User) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseInt(topicData.deleted) === 0) {
|
if (parseInt(topicData.deleted, 10) === 0) {
|
||||||
db.decrObjectField('global', 'topicCount', callback);
|
db.decrObjectField('global', 'topicCount', callback);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
Reference in New Issue
Block a user