Added logging for admin removal

This commit is contained in:
Absurdon 2018-12-01 12:21:56 +01:00
parent 2531d82221
commit efaa7ae94f

View file

@ -32,7 +32,7 @@ const emitGather = (socket, gather) => {
type: gather ? gather.type : null,
maps: Map.list,
servers: Server.list
});
});
}
module.exports = function (namespace) {
@ -99,12 +99,12 @@ module.exports = function (namespace) {
let helper = require("./helper");
GatherPool.forEach(gatherManager => {
helper.createTestUsers({
gather: gatherManager.current
}, refreshGather());
helper.createTestUsers({
gather: gatherManager.current
}, refreshGather());
});
}
namespace.on("connection", function (socket) {
ArchivedGather.recent((error, recentGathers) => {
if (error) return winston.error(error);
@ -165,7 +165,10 @@ module.exports = function (namespace) {
if (data.gatherer) {
// Remove gatherer defined by ID (admins only)
if (!socket._user.isGatherAdmin()) return;
removeGatherer(gather, { id: data.gatherer, cooldown: true });
removeGatherer(gather, { id: data.gatherer, cooldown: true });
let adminName = socket._user.username;
let playerName = data.gatherer.user.username;
winston.info(`Admin removal: ${adminName} removed ${playerName} from the gather.`);
} else {
// Remove gatherer attached to socket
removeGatherer(gather, socket._user);
@ -201,7 +204,7 @@ module.exports = function (namespace) {
// Check if last player and add to last team
if (gather.lobby().length === 1) {
let assignLast = (gather.marines().length === 6) ?
let assignLast = (gather.marines().length === 6) ?
gather.moveToAlien : gather.moveToMarine;
assignLast.call(gather, gather.lobby().pop());
}
@ -216,7 +219,7 @@ module.exports = function (namespace) {
});
socket.on("disconnect", function () {
});
socket.on("gather:vote", function (data) {