Fix userlist and chat after reconnection in a shared worker

pull/1/head
yflory 6 years ago
parent 652583eec1
commit 9b9cedd191

@ -965,6 +965,7 @@ define([
if (channel.padChan !== padChan) { return; } if (channel.padChan !== padChan) { return; }
if (channel.wc) { channel.wc.leave(); } if (channel.wc) { channel.wc.leave(); }
channel.stopped = true; channel.stopped = true;
delete channels[chatChan];
return true; return true;
}); });
}; };

@ -133,7 +133,7 @@ define(['json.sortify'], function (Sortify) {
if (idx === -1) { console.log('Error: ' + ev + ' not in members'); return; } if (idx === -1) { console.log('Error: ' + ev + ' not in members'); return; }
members.splice(idx, 1); members.splice(idx, 1);
if (!meta.user) { return; } if (!meta.user) { return; }
change(false); change(true);
}); });
sframeChan.on('EV_RT_DISCONNECT', function () { sframeChan.on('EV_RT_DISCONNECT', function () {
members = []; members = [];

@ -1262,9 +1262,15 @@ define([
var messengerEventClients = []; var messengerEventClients = [];
var dropChannel = function (chanId) { var dropChannel = function (chanId) {
store.messenger.leavePad(chanId); try {
store.cursor.leavePad(chanId); store.messenger.leavePad(chanId);
store.onlyoffice.leavePad(chanId); } catch (e) { console.error(e); }
try {
store.cursor.leavePad(chanId);
} catch (e) { console.error(e); }
try {
store.onlyoffice.leavePad(chanId);
} catch (e) { console.error(e); }
if (!Store.channels[chanId]) { return; } if (!Store.channels[chanId]) { return; }
@ -1283,8 +1289,12 @@ define([
if (messengerIdx !== -1) { if (messengerIdx !== -1) {
messengerEventClients.splice(messengerIdx, 1); messengerEventClients.splice(messengerIdx, 1);
} }
store.cursor.removeClient(clientId); try {
store.onlyoffice.removeClient(clientId); store.cursor.removeClient(clientId);
} catch (e) { console.error(e); }
try {
store.onlyoffice.removeClient(clientId);
} catch (e) { console.error(e); }
Object.keys(Store.channels).forEach(function (chanId) { Object.keys(Store.channels).forEach(function (chanId) {
var chanIdx = Store.channels[chanId].clients.indexOf(clientId); var chanIdx = Store.channels[chanId].clients.indexOf(clientId);

@ -533,6 +533,7 @@ define([
} }
}; };
cpNfInner.metadataMgr.onChange(checkReady); cpNfInner.metadataMgr.onChange(checkReady);
cpNfInner.metadataMgr.onChange(onLocal);
checkReady(); checkReady();
var infiniteSpinnerModal = false; var infiniteSpinnerModal = false;

@ -269,6 +269,9 @@ define([
sessionStorage[Utils.Constants.displayPadCreationScreen]; sessionStorage[Utils.Constants.displayPadCreationScreen];
delete sessionStorage[Utils.Constants.displayPadCreationScreen]; delete sessionStorage[Utils.Constants.displayPadCreationScreen];
var updateMeta = function () { var updateMeta = function () {
// TODO availableHashes in privateData may need updates once we have
// a better privileges workflow
//console.log('EV_METADATA_UPDATE'); //console.log('EV_METADATA_UPDATE');
var metaObj, isTemplate; var metaObj, isTemplate;
nThen(function (waitFor) { nThen(function (waitFor) {

Loading…
Cancel
Save