Fixed overzealous welcome wagon

This commit is contained in:
rainbow napkin 2026-10-15 01:30:38 -04:00
parent 42accf52ca
commit ccb468078c
2 changed files with 15 additions and 7 deletions

View file

@ -96,11 +96,12 @@ class connectedUser{
* @param {Mongoose.Document} userDB - User Document Passthrough to save on DB Access
* @param {Mongoose.Document} chanDB - Channnel Document Passthrough to save on DB Access
* @param {Socket} socket - Requesting Socket
* @param {Boolean} first - thrown true if this is the socket for this user on this channel
* @returns {activeUser} active user object generated by the new connection
*/
async handleConnection(userDB, chanDB, socket){
async handleConnection(userDB, chanDB, socket, first){
//send metadata to client
this.sendClientMetadata();
this.sendClientMetadata(undefined, undefined, first);
//Send out emotes
this.sendSiteEmotes();
@ -122,7 +123,6 @@ class connectedUser{
await userDB.tattooIPRecord(socket.handshake.address);
}
//Return active user object for use by activeChannel and channelManager objects
return this;
}
@ -179,8 +179,9 @@ class connectedUser{
* Sends glut of required initial metadata to the client upon a new connection
* @param {Mongoose.Document} userDB - User Document Passthrough to save on DB Access
* @param {Mongoose.Document} chanDB - Channnel Document Passthrough to save on DB Access
* @param {Boolean} welcome - Whether or not to throw welcome wagon, ensures we dont welcome before the metadata is sent
*/
async sendClientMetadata(userDB, chanDB){
async sendClientMetadata(userDB, chanDB, welcome){
//Get flairList from DB and setup flairList array
const flairListDB = await flairModel.find({});
var flairList = [];
@ -238,8 +239,11 @@ class connectedUser{
//Send off the metadata to our user's clients
this.emit("clientMetadata", {user: userObj, flairList, queueLock, chatBuffer, streamType: chanDB.settings.streamType});
//Broadcast the welcome wagon
this.channel.welcomeWagon(userDB.user);
//If we where told to welcome the user
if(welcome){
//Broadcast the welcome wagon
this.channel.welcomeWagon(userDB.user);
}
}
/**