Finished up with css-only flair implementation.

This commit is contained in:
rainbow napkin 2024-11-21 08:42:21 -05:00
parent 5b5f495853
commit 9dbbc4e924
13 changed files with 231 additions and 60 deletions

View file

@ -20,7 +20,6 @@ const validator = require('validator');//No express here, so regular validator i
//local imports
const loggerUtils = require('../../utils/loggerUtils');
const userModel = require('../../schemas/userSchema');
const channelManager = require('./channelManager');
module.exports = class{
constructor(server){
@ -54,13 +53,20 @@ module.exports = class{
}
async setFlair(socket, data){
const userDB = await userModel.findOne({user: socket.user.user});
var userDB = await userModel.findOne({user: socket.user.user});
const chanList = this.server.getConnectedChannels(socket)
if(userDB){
try{
//We can take this data raw since our schema checks it against existing flairs, and mongoose sanatizes queries
userDB.flair = data.flair;
await userDB.save();
userDB = await userDB.save();
chanList.forEach((channel) => {
channel.updateFlair(userDB.user, userDB.flair);
});
}catch(err){
return loggerUtils.socketExceptionHandler(socket, err);
}