highLevel syncs across chans, shows in userlist
This commit is contained in:
parent
279640a7e7
commit
8ccb9003cc
8 changed files with 102 additions and 38 deletions
|
|
@ -19,12 +19,13 @@ const flairModel = require('../../schemas/flairSchema');
|
|||
const permissionModel = require('../../schemas/permissionSchema');
|
||||
|
||||
module.exports = class{
|
||||
constructor(id, name, rank, chanRank, flair, channel, socket){
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.rank = rank;
|
||||
constructor(userDB, chanRank, channel, socket){
|
||||
this.id = userDB.id;
|
||||
this.user = userDB.user;
|
||||
this.rank = userDB.rank;
|
||||
this.highLevel = userDB.highLevel;
|
||||
this.flair = userDB.flair.name;
|
||||
this.chanRank = chanRank;
|
||||
this.flair = flair;
|
||||
this.channel = channel;
|
||||
this.sockets = [socket.id];
|
||||
}
|
||||
|
|
@ -59,6 +60,8 @@ module.exports = class{
|
|||
id: this.id,
|
||||
user: this.user,
|
||||
rank: this.rank,
|
||||
chanRank: this.chanRank,
|
||||
highLevel: this.highLevel,
|
||||
flair: this.flair
|
||||
}
|
||||
|
||||
|
|
@ -79,12 +82,17 @@ module.exports = class{
|
|||
}
|
||||
|
||||
updateFlair(flair){
|
||||
//This will run multiple times in a row, we don't need to broadcast the userlist every time
|
||||
if(this.flair != flair){
|
||||
this.flair = flair;
|
||||
this.channel.broadcastUserList();
|
||||
}
|
||||
this.flair = flair;
|
||||
|
||||
this.channel.broadcastUserList();
|
||||
this.sendClientMetadata();
|
||||
}
|
||||
|
||||
updateHighLevel(highLevel){
|
||||
this.highLevel = highLevel;
|
||||
|
||||
//TODO: show high-level in userlist
|
||||
this.channel.broadcastUserList();
|
||||
this.sendClientMetadata();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue