Replaced window.prompt()/alert() with custom popup
This commit is contained in:
parent
8ccb9003cc
commit
ee5a8d9516
14 changed files with 138 additions and 63 deletions
|
|
@ -127,12 +127,15 @@ channelSchema.pre('save', async function (next){
|
|||
|
||||
//if the channel is online
|
||||
if(activeChan != null){
|
||||
//Get the relevant user connection
|
||||
const userConn = activeChan.userList.get(foundRank.user.user);
|
||||
//if the user is online
|
||||
if(userConn != null){
|
||||
//kick the user
|
||||
userConn.disconnect("Your channel rank has changed!");
|
||||
//make sure we're not trying to kick a deleted user
|
||||
if(foundRank.user != null){
|
||||
//Get the relevant user connection
|
||||
const userConn = activeChan.userList.get(foundRank.user.user);
|
||||
//if the user is online
|
||||
if(userConn != null){
|
||||
//kick the user
|
||||
userConn.disconnect("Your channel rank has changed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -322,17 +325,24 @@ channelSchema.methods.getRankList = async function(){
|
|||
await this.populate('rankList.user');
|
||||
|
||||
//For each rank object in the rank list
|
||||
this.rankList.forEach(async (rankObj) => {
|
||||
//Create a new user object from rank object data
|
||||
const userObj = {
|
||||
id: rankObj.user.id,
|
||||
user: rankObj.user.user,
|
||||
img: rankObj.user.img,
|
||||
rank: rankObj.rank
|
||||
}
|
||||
this.rankList.forEach(async (rankObj, rankObjIndex) => {
|
||||
//If the use still exists
|
||||
if(rankObj.user != null){
|
||||
//Create a new user object from rank object data
|
||||
const userObj = {
|
||||
id: rankObj.user.id,
|
||||
user: rankObj.user.user,
|
||||
img: rankObj.user.img,
|
||||
rank: rankObj.rank
|
||||
}
|
||||
|
||||
//Add our user object to the list
|
||||
rankList.set(rankObj.user.user, userObj);
|
||||
//Add our user object to the list
|
||||
rankList.set(rankObj.user.user, userObj);
|
||||
}else{
|
||||
//Otherwise clean deleted users out of list
|
||||
this.rankList.splice(rankObjIndex,1);
|
||||
await this.save();
|
||||
}
|
||||
});
|
||||
|
||||
//return userList
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue