mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-17 21:42:07 +02:00
add label to banned users, dont hide their posts
This commit is contained in:
@@ -291,32 +291,14 @@ var RDB = require('./redis.js'),
|
||||
if(!numPosts)
|
||||
return callback(new Error('no-undeleted-pids-found'));
|
||||
|
||||
posts = posts.reverse();
|
||||
lastPostId = 0;
|
||||
|
||||
function isPostVisible(post, next) {
|
||||
if(post.deleted !== '1') {
|
||||
user.getUserField(post.uid, 'banned', function(banned) {
|
||||
if(banned && banned === '1') {
|
||||
next(null);
|
||||
} else {
|
||||
lastPostId = post.pid
|
||||
next(post.pid);
|
||||
return;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next(null);
|
||||
while(numPosts--) {
|
||||
if(posts[numPosts].deleted !== '1') {
|
||||
callback(null, posts[numPosts].pid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async.eachSeries(posts, isPostVisible, function(err) {
|
||||
if(err) {
|
||||
callback(null, lastPostId);
|
||||
} else {
|
||||
callback(new Error('no-undeleted-pids-found'));
|
||||
}
|
||||
});
|
||||
|
||||
callback(new Error('no-undeleted-pids-found'));
|
||||
});
|
||||
}
|
||||
}(exports));
|
||||
Reference in New Issue
Block a user