mirror of https://github.com/calzoneman/sync.git
Fix previous fix
This commit is contained in:
parent
e9fdb1a7e5
commit
c70dc83504
|
@ -322,8 +322,7 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (self.is(Flags.C_REGISTERED)) {
|
||||
user.waitFlag(Flags.U_LOGGED_IN, () => {
|
||||
function refreshUserAccount(cb) {
|
||||
user.refreshAccount({
|
||||
channel: self.name,
|
||||
name: user.getName()
|
||||
|
@ -335,9 +334,19 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (cb) {
|
||||
process.nextTick(cb);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (self.is(Flags.C_REGISTERED) && user.is(Flags.U_LOGGED_IN)) {
|
||||
refreshUserAccount(afterAccount);
|
||||
} else if (self.is(Flags.C_REGISTERED)) {
|
||||
user.waitFlag(Flags.U_LOGGED_IN, () => {
|
||||
refreshUserAccount();
|
||||
});
|
||||
afterAccount();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
afterAccount();
|
||||
}
|
||||
|
|
|
@ -301,7 +301,6 @@ User.prototype.login = function (name, pw) {
|
|||
name: user.name
|
||||
});
|
||||
db.recordVisit(self.realip, self.getName());
|
||||
self.socket.emit("rank", self.account.effectiveRank);
|
||||
Logger.syslog.log(self.realip + " logged in as " + user.name);
|
||||
self.setFlag(Flags.U_LOGGED_IN);
|
||||
self.clearFlag(Flags.U_LOGGING_IN);
|
||||
|
@ -388,7 +387,6 @@ User.prototype.guestLogin = function (name) {
|
|||
guest: true
|
||||
});
|
||||
db.recordVisit(self.realip, self.getName());
|
||||
self.socket.emit("rank", 0);
|
||||
Logger.syslog.log(self.realip + " signed in as " + name);
|
||||
self.setFlag(Flags.U_LOGGED_IN);
|
||||
self.emit("login", self.account);
|
||||
|
@ -443,6 +441,7 @@ User.prototype.refreshAccount = function (opts, cb) {
|
|||
}
|
||||
self.account = account;
|
||||
if (account.effectiveRank !== old.effectiveRank) {
|
||||
self.socket.emit("rank", self.account.effectiveRank);
|
||||
self.emit("effectiveRankChange", self.account.effectiveRank);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue