Fix degraded mode not set when multiple tabs on the same pad

pull/1/head
yflory 4 years ago
parent e1e1795714
commit 31414ca7b0

@ -50,6 +50,12 @@ define([
});
};
var updateDegraded = function (ctx, wc, chan) {
var m = wc.members;
chan.degraded = (m.length-1) >= DEGRADED;
ctx.emit('DEGRADED', { degraded: chan.degraded }, chan.clients);
};
var initCursor = function (ctx, obj, client, cb) {
var channel = obj.channel;
var secret = obj.secret;
@ -92,14 +98,10 @@ define([
// ==> And push the new tab to the list
chan.clients.push(client);
updateDegraded(ctx, chan.wc, chan);
return void cb();
}
var updateDegraded = function (ctx, wc, chan) {
var m = wc.members;
chan.degraded = (m.length-1) >= DEGRADED;
ctx.emit('DEGRADED', { degraded: chan.degraded }, chan.clients);
};
var onOpen = function (wc) {
ctx.channels[channel] = ctx.channels[channel] || {};

Loading…
Cancel
Save