From 7c3f2d0a8b8926f9f5fb92888562abd8481e4b23 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Thu, 6 Oct 2016 23:22:02 -0700 Subject: [PATCH] only set channel rank for non-guest --- package.json | 2 +- src/channel/channel.js | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 57d0fd15..068b74ad 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.23.1", + "version": "3.23.2", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel/channel.js b/src/channel/channel.js index e293624f..3286bff0 100644 --- a/src/channel/channel.js +++ b/src/channel/channel.js @@ -330,18 +330,20 @@ Channel.prototype.joinUser = function (user, data) { user.channel = self; user.waitFlag(Flags.U_LOGGED_IN, () => { - db.channels.getRank(self.name, user.getName(), (error, rank) => { - if (!error) { - user.setChannelRank(rank); - user.setFlag(Flags.U_HAS_CHANNEL_RANK); - if (user.inChannel()) { - self.broadcastAll("setUserRank", { - name: user.getName(), - rank: rank - }); + if (user.is(Flags.U_REGISTERED)) { + db.channels.getRank(self.name, user.getName(), (error, rank) => { + if (!error) { + user.setChannelRank(rank); + user.setFlag(Flags.U_HAS_CHANNEL_RANK); + if (user.inChannel()) { + self.broadcastAll("setUserRank", { + name: user.getName(), + rank: rank + }); + } } - } - }); + }); + } }); if (user.socket.disconnected) {