Connected users now get kicked on channel ban.
This commit is contained in:
parent
96953979a2
commit
ebbdcbe295
|
|
@ -19,6 +19,7 @@ const {mongoose} = require('mongoose');
|
|||
const {validationResult, matchedData} = require('express-validator');
|
||||
|
||||
//Local Imports
|
||||
const server = require('../../server');
|
||||
const statModel = require('../statSchema');
|
||||
const {userModel} = require('../userSchema');
|
||||
const permissionModel = require('../permissionSchema');
|
||||
|
|
@ -414,6 +415,18 @@ channelSchema.methods.banByUserDoc = async function(userDB, expirationDays, banA
|
|||
banAlts
|
||||
}
|
||||
|
||||
const activeChan = server.channelManager.activeChannels.get(this.name);
|
||||
if(activeChan != null){
|
||||
const userConn = activeChan.userList.get(userDB.user);
|
||||
if(userConn != null){
|
||||
if(expirationDays < 0){
|
||||
userConn.disconnect("You have been permanently banned from this channel!");
|
||||
}else{
|
||||
userConn.disconnect(`You have been banned from this channel for ${expirationDays} day(s)!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Push the ban to the list
|
||||
this.banList.push(banDoc);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue