mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-13 14:29:25 -05:00
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:
19
js/sim.js
19
js/sim.js
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user