mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
cleanup of PR - fixed some logic bugs and linted
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
# NodeBB
|
# NodeBB
|
||||||
**NodeBB** is a robust Node.js driven forum built on a redis database. It is powered by web sockets, and is compatible down to IE8.
|
**NodeBB** is a robust Node.js driven forum built on a redis database. It is powered by web sockets, and is compatible down to IE8.
|
||||||
|
|
||||||
|
|
||||||
* [NodeBB Homepage](http://www.nodebb.org/ "NodeBB")
|
* [NodeBB Homepage](http://www.nodebb.org/ "NodeBB")
|
||||||
* [Demo & Meta Discussion](http://try.nodebb.org)
|
* [Demo & Meta Discussion](http://try.nodebb.org)
|
||||||
* [Wiki Guides](https://github.com/designcreateplay/NodeBB/wiki) - includes setup for other platforms
|
* [Wiki Guides](https://github.com/designcreateplay/NodeBB/wiki) - includes setup for other platforms
|
||||||
|
|||||||
@@ -32,30 +32,30 @@ define(function() {
|
|||||||
else
|
else
|
||||||
banBtn.removeClass('btn-warning');
|
banBtn.removeClass('btn-warning');
|
||||||
updateUserAdminButtons();
|
updateUserAdminButtons();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateUserAdminButtons() {
|
function updateUserAdminButtons() {
|
||||||
jQuery('.admin-btn').each(function(index, element) {
|
jQuery('.admin-btn').each(function(index, element) {
|
||||||
var banBtn = $(element);
|
var adminBtn = $(element);
|
||||||
var uid = getUID(banBtn);
|
var uid = getUID(adminBtn);
|
||||||
if (isUserAdmin(banBtn) || uid === yourid)
|
if (isUserAdmin(adminBtn)) {
|
||||||
|
adminBtn.attr('value', 'UnMake Admin').html('Remove Admin');
|
||||||
banBtn.attr('value', 'UnMake Admin').html('Remove as Admin');
|
if (uid === yourid) {
|
||||||
|
adminBtn.addClass('disabled');
|
||||||
else if (isUserBanned(banBtn))
|
}
|
||||||
banBtn.addClass('disabled');
|
}
|
||||||
else if (!isUserBanned(banBtn))
|
else if (isUserBanned(adminBtn))
|
||||||
banBtn.removeClass('disabled');
|
adminBtn.addClass('disabled');
|
||||||
|
else if (!isUserBanned(adminBtn))
|
||||||
|
adminBtn.removeClass('disabled');
|
||||||
else
|
else
|
||||||
banBtn.removeClass('btn-warning');
|
adminBtn.removeClass('btn-warning');
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function initUsers() {
|
function initUsers() {
|
||||||
|
|
||||||
updateUserBanButtons();
|
updateUserBanButtons();
|
||||||
updateUserAdminButtons();
|
updateUserAdminButtons();
|
||||||
|
|
||||||
@@ -95,11 +95,16 @@ define(function() {
|
|||||||
var uid = getUID(adminBtn);
|
var uid = getUID(adminBtn);
|
||||||
|
|
||||||
if(uid === yourid){
|
if(uid === yourid){
|
||||||
alert("you can't remove yourself as admin");
|
app.alert({
|
||||||
|
title: 'Error',
|
||||||
|
message: 'You can\'t remove yourself as Administrator!',
|
||||||
|
type: 'danger',
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (!isAdmin) {
|
else if (!isAdmin) {
|
||||||
socket.emit('api:admin.user.makeAdmin', uid);
|
socket.emit('api:admin.user.makeAdmin', uid);
|
||||||
adminBtn.attr('value', 'UnMake Admin').html('Remove as Admin');
|
adminBtn.attr('value', 'UnMake Admin').html('Remove Admin');
|
||||||
parent.attr('data-admin', 1);
|
parent.attr('data-admin', 1);
|
||||||
updateUserBanButtons();
|
updateUserBanButtons();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user