Changes to mute/ban/kick buttons

- mute/ban/kick buttons are now only shown if the user can use the
  corresponding command. This determination is based on the permissions
  in use on the main server (and hardcoded as such) because the server
  does not currently send the client any information about permissions.
  In particular, regular users will no longer see the buttons when
  viewing their own profile.

- there is now a blank line between a user's IP address and the auth
  buttons.
This commit is contained in:
Cathy J. Fitzpatrick
2013-02-17 21:12:47 -07:00
parent 3b860f6fd5
commit 7aaeedffd6

View File

@@ -1800,14 +1800,19 @@ function Lobby(id, elem) {
if (data.ip) {
// Mute and Ban buttons for auths
var banMuteBuffer = '';
// var isAuth = me.users[me.userid].substr(0,1) in {'%':1, '@':1, '&':1, '~':1};
if (me.users[userid].substr(0,1) === '!') {
banMuteBuffer += '<br /><button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonunmute ' + userid + '\');">Unmute</button>';
} else {
banMuteBuffer += '<br /><button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonmute ' + userid + '\');">Mute</button>';
var mygroup = me.users[me.userid].substr(0, 1);
if ([' ', '!', '#'].indexOf(mygroup) === -1) {
banMuteBuffer += '<br /><br />';
if (me.users[userid].substr(0, 1) === '!') {
banMuteBuffer += '<button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonunmute ' + userid + '\');">Unmute</button>';
} else {
banMuteBuffer += '<button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonmute ' + userid + '\');">Mute</button>';
}
if (mygroup !== '%') {
banMuteBuffer += ' <button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonban ' + userid + '\');">Ban</button>';
banMuteBuffer += ' <button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonkick ' + userid + '\');">Kick</button>';
}
}
banMuteBuffer += ' <button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonban ' + userid + '\');">Ban</button>';
banMuteBuffer += ' <button onclick="rooms[\'' + selfR.id + '\'].parseCommand(\'/buttonkick ' + userid + '\');">Kick</button>';
roomListCode = '<div class="action-form"><small>IP: <a href="http://www.geoiptool.com/en/?IP=' + data.ip + '" target="iplookup">' + data.ip + '</a></small>'+banMuteBuffer+'</div>' + roomListCode;
}
$('#' + selfR.id + '-userrooms-' + userid).html(roomListCode);