Fix race condition which caused users to lose moderatorship

This commit is contained in:
calzoneman 2013-05-17 11:02:45 -04:00
parent 767cfdd76e
commit 74bdffea58
3 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "1.7.5", "version": "1.7.6",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
const VERSION = "1.7.5"; const VERSION = "1.7.6";
var fs = require("fs"); var fs = require("fs");
var Logger = require("./logger.js"); var Logger = require("./logger.js");

View File

@ -92,14 +92,19 @@ User.prototype.initCallbacks = function() {
// Channel already loaded // Channel already loaded
if(data.name in Server.channels) { if(data.name in Server.channels) {
this.channel = Server.channels[data.name]; this.channel = Server.channels[data.name];
this.channel.userJoin(this);
} }
// Channel not loaded // Channel not loaded
else { else {
Server.channels[data.name] = new Channel(data.name); Server.channels[data.name] = new Channel(data.name);
this.channel = Server.channels[data.name]; this.channel = Server.channels[data.name];
this.channel.userJoin(this);
} }
if(this.loggedIn) {
var chanrank = this.channel.getRank(this.name);
if(chanrank > this.rank) {
this.rank = chanrank;
}
}
this.channel.userJoin(this);
}.bind(this)); }.bind(this));
this.socket.on("login", function(data) { this.socket.on("login", function(data) {