mirror of https://github.com/calzoneman/sync.git
Fix dump bug
This commit is contained in:
parent
0d89c13c05
commit
042e4544b7
|
@ -136,6 +136,11 @@ Channel.prototype.hasPermission = function(user, key) {
|
|||
Channel.prototype.loadDump = function() {
|
||||
fs.readFile("chandump/" + this.name, function(err, data) {
|
||||
if(err) {
|
||||
if(err.code === "ENOENT") {
|
||||
Logger.errlog.log("WARN: missing dump for " + this.name);
|
||||
this.initialized = true;
|
||||
this.saveDump();
|
||||
}
|
||||
Logger.errlog.log("Failed to open channel dump " + this.name);
|
||||
Logger.errlog.log(err);
|
||||
return;
|
||||
|
@ -281,6 +286,8 @@ Channel.prototype.tryRegister = function(user) {
|
|||
else {
|
||||
if(Database.registerChannel(this.name)) {
|
||||
this.registered = true;
|
||||
this.initialized = true;
|
||||
this.saveDump();
|
||||
this.saveRank(user);
|
||||
user.socket.emit("registerChannel", {
|
||||
success: true,
|
||||
|
|
Loading…
Reference in New Issue