mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
add label to banned users, dont hide their posts
This commit is contained in:
@@ -197,6 +197,12 @@ footer.footer {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.account-block {
|
||||
div {
|
||||
padding-bottom:10px;
|
||||
}
|
||||
}
|
||||
|
||||
.account-picture-block{
|
||||
display:inline-block;
|
||||
vertical-align:top;
|
||||
@@ -213,7 +219,6 @@ footer.footer {
|
||||
|
||||
.user-profile-picture {
|
||||
width:128px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.user-picture-label {
|
||||
|
||||
@@ -17,13 +17,16 @@
|
||||
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span2" style="text-align: center; margin-bottom:20px;">
|
||||
<div class="span2 account-block" style="text-align: center; margin-bottom:20px;">
|
||||
<div class="account-picture-block">
|
||||
<img src="{picture}" class="user-profile-picture img-polaroid"/>
|
||||
</div>
|
||||
<div class="account-online-status">
|
||||
<span><i class="icon-circle-blank"></i> <span>offline</span></span>
|
||||
</div>
|
||||
<div class="{show_banned}">
|
||||
<span class="label label-important">banned</span>
|
||||
</div>
|
||||
<div id="user-actions">
|
||||
<a id="follow-btn" href="#" class="btn hide">Follow</a>
|
||||
<a id="unfollow-btn" href="#" class="btn hide">Unfollow</a>
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span>
|
||||
<div id="ids_{posts.pid}_{posts.uid}" class="chat hidden-phone" title="Chat"><i class="icon-comment"></i></div>
|
||||
</div>
|
||||
<span class="label label-important {posts.show_banned}">banned</span>
|
||||
</div>
|
||||
<div class="span11 span12-tablet">
|
||||
<div class="post-block">
|
||||
|
||||
@@ -55,8 +55,7 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
|
||||
function getActiveUsers(next) {
|
||||
user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture', 'banned'], function(users) {
|
||||
users = user.filterBannedUsers(users);
|
||||
user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture'], function(users) {
|
||||
next(null, users);
|
||||
});
|
||||
}
|
||||
@@ -201,7 +200,6 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
|
||||
posts.getPostSummaryByPids(pids, function(postData) {
|
||||
postData = posts.filterBannedPosts(postData);
|
||||
if(postData.length > count) {
|
||||
postData = postData.slice(0, count);
|
||||
}
|
||||
|
||||
@@ -64,19 +64,13 @@ var user = require('./../user.js'),
|
||||
|
||||
user.get_uid_by_userslug(req.params.userslug, function(uid) {
|
||||
if(!uid) {
|
||||
next();
|
||||
return;
|
||||
return next();
|
||||
}
|
||||
|
||||
user.getUserField(uid, 'banned', function(banned) {
|
||||
if(banned && banned === '1') {
|
||||
next();
|
||||
} else {
|
||||
app.build_header({ req: req, res: res }, function(err, header) {
|
||||
res.send(header + app.create_route('users/' + req.params.userslug, 'account') + templates['footer']);
|
||||
});
|
||||
}
|
||||
});
|
||||
app.build_header({ req: req, res: res }, function(err, header) {
|
||||
res.send(header + app.create_route('users/' + req.params.userslug, 'account') + templates['footer']);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -327,21 +321,18 @@ var user = require('./../user.js'),
|
||||
|
||||
function getUsersSortedByJoinDate(req, res) {
|
||||
user.getUsers('users:joindate', 0, 49, function(err, data) {
|
||||
data = user.filterBannedUsers(data);
|
||||
res.json({ search_display: 'none', loadmore_display:'block', users:data });
|
||||
});
|
||||
}
|
||||
|
||||
function getUsersSortedByPosts(req, res) {
|
||||
user.getUsers('users:postcount', 0, 49, function(err, data) {
|
||||
data = user.filterBannedUsers(data);
|
||||
res.json({ search_display: 'none', loadmore_display:'block', users:data });
|
||||
});
|
||||
}
|
||||
|
||||
function getUsersSortedByReputation(req, res) {
|
||||
user.getUsers('users:reputation', 0, 49, function(err, data) {
|
||||
data = user.filterBannedUsers(data);
|
||||
res.json({ search_display: 'none', loadmore_display:'block', users:data });
|
||||
});
|
||||
}
|
||||
@@ -380,7 +371,8 @@ var user = require('./../user.js'),
|
||||
else
|
||||
data.emailClass = "hide";
|
||||
|
||||
|
||||
data.show_banned = data.banned === '1'?'':'hide';
|
||||
|
||||
data.uid = uid;
|
||||
data.yourid = callerUID;
|
||||
data.theirid = uid;
|
||||
|
||||
@@ -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));
|
||||
@@ -78,11 +78,10 @@ marked.setOptions({
|
||||
var fav_data = results[0],
|
||||
privileges = results[2];
|
||||
|
||||
postData = posts.filterBannedPosts(postData);
|
||||
|
||||
for(var i=0; i<postData.length; ++i) {
|
||||
postData[i].fav_star_class = fav_data[postData[i].pid] ? 'icon-star' : 'icon-star-empty';
|
||||
postData[i]['display_moderator_tools'] = (postData[i].uid == current_user || privileges.editable) ? 'show' : 'none';
|
||||
postData[i].show_banned = postData[i].user_banned === '1'?'show':'hide';
|
||||
}
|
||||
|
||||
callback(postData);
|
||||
@@ -197,7 +196,7 @@ marked.setOptions({
|
||||
function getTopicInfo(topicData, callback) {
|
||||
|
||||
function getUserInfo(next) {
|
||||
user.getUserFields(topicData.uid, ['username', 'banned'], function(userData) {
|
||||
user.getUserFields(topicData.uid, ['username'], function(userData) {
|
||||
next(null, userData);
|
||||
});
|
||||
}
|
||||
@@ -234,10 +233,7 @@ marked.setOptions({
|
||||
|
||||
function isTopicVisible(topicData, topicInfo) {
|
||||
var deleted = parseInt(topicData.deleted, 10) !== 0;
|
||||
var banned = false;
|
||||
if(topicData.userbanned)
|
||||
banned = parseInt(topicData.userbanned, 10) !== 0;
|
||||
return !banned && (!deleted || (deleted && topicInfo.privileges.view_deleted) || topicData.uid === current_user);
|
||||
return !deleted || (deleted && topicInfo.privileges.view_deleted) || topicData.uid === current_user;
|
||||
}
|
||||
|
||||
function loadTopic(tid, callback) {
|
||||
@@ -255,7 +251,6 @@ marked.setOptions({
|
||||
topicData.relativeTime = utils.relativeTime(topicData.timestamp);
|
||||
|
||||
topicData.username = topicInfo.username;
|
||||
topicData.userbanned = topicInfo.userbanned;
|
||||
topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important';
|
||||
topicData.teaser_text = topicInfo.teaserInfo.text || '',
|
||||
topicData.teaser_username = topicInfo.teaserInfo.username || '';
|
||||
|
||||
@@ -671,7 +671,6 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
if(err) {
|
||||
winston.err(err);
|
||||
} else {
|
||||
data = user.filterBannedUsers(data);
|
||||
callback({users:data});
|
||||
}
|
||||
});
|
||||
@@ -720,12 +719,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
socket.on('api:admin.user.search', function(username) {
|
||||
if(uid && uid > 0) {
|
||||
user.search(username, function(data) {
|
||||
user.isAdministrator(uid, function(isAdmin) {
|
||||
if(!isAdmin)
|
||||
data = user.filterBannedUsers(data);
|
||||
|
||||
socket.emit('api:admin.user.search', data);
|
||||
});
|
||||
socket.emit('api:admin.user.search', data);
|
||||
});
|
||||
} else {
|
||||
socket.emit('api:admin.user.search', null);
|
||||
|
||||
Reference in New Issue
Block a user