Seperated out socket validation/authorization from channel mangement logic.
This commit is contained in:
parent
d541dce8c4
commit
7da07c8717
4 changed files with 108 additions and 74 deletions
|
|
@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
|
||||
//local includes
|
||||
const server = require('../server');
|
||||
const userSchema = require('../schemas/user/userSchema');
|
||||
const {userModel} = require('../schemas/user/userSchema');
|
||||
|
||||
//User activity map to keep us from constantly reading off of the DB
|
||||
let activityMap = new Map();
|
||||
|
|
@ -47,7 +47,7 @@ module.exports.getPresence = async function(user, userDB){
|
|||
//If we wheren't handed a free user doc
|
||||
if(userDB == null){
|
||||
//Pull one from the username
|
||||
userDB = await userSchema.userModel.findOne({user: user});
|
||||
userDB = await userModel.findOne({user: user});
|
||||
}
|
||||
|
||||
//If for some reason we can't find a user doc
|
||||
|
|
@ -119,7 +119,7 @@ module.exports.handlePresence = async function(user, userDB, noSave = false){
|
|||
//If we wheren't handed a free user doc
|
||||
if(userDB == null){
|
||||
//Pull one from the username
|
||||
userDB = await userSchema.userModel.findOne({user: user});
|
||||
userDB = await userModel.findOne({user: user});
|
||||
}
|
||||
|
||||
//Set last active in user's DB document
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue