diff --git a/www/common/common-messenger.js b/www/common/common-messenger.js index b8ea783a5..c333112d9 100644 --- a/www/common/common-messenger.js +++ b/www/common/common-messenger.js @@ -965,6 +965,7 @@ define([ if (channel.padChan !== padChan) { return; } if (channel.wc) { channel.wc.leave(); } channel.stopped = true; + delete channels[chatChan]; return true; }); }; diff --git a/www/common/metadata-manager.js b/www/common/metadata-manager.js index 684ddcdd2..05774e4cb 100644 --- a/www/common/metadata-manager.js +++ b/www/common/metadata-manager.js @@ -133,7 +133,7 @@ define(['json.sortify'], function (Sortify) { if (idx === -1) { console.log('Error: ' + ev + ' not in members'); return; } members.splice(idx, 1); if (!meta.user) { return; } - change(false); + change(true); }); sframeChan.on('EV_RT_DISCONNECT', function () { members = []; diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 0ab5ff0eb..3dca7febf 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1262,9 +1262,15 @@ define([ var messengerEventClients = []; var dropChannel = function (chanId) { - store.messenger.leavePad(chanId); - store.cursor.leavePad(chanId); - store.onlyoffice.leavePad(chanId); + try { + store.messenger.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; } @@ -1283,8 +1289,12 @@ define([ if (messengerIdx !== -1) { messengerEventClients.splice(messengerIdx, 1); } - store.cursor.removeClient(clientId); - store.onlyoffice.removeClient(clientId); + try { + 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) { var chanIdx = Store.channels[chanId].clients.indexOf(clientId); diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 263781130..8c05678f8 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -533,6 +533,7 @@ define([ } }; cpNfInner.metadataMgr.onChange(checkReady); + cpNfInner.metadataMgr.onChange(onLocal); checkReady(); var infiniteSpinnerModal = false; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index f46662c40..dc1031a83 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -269,6 +269,9 @@ define([ sessionStorage[Utils.Constants.displayPadCreationScreen]; delete sessionStorage[Utils.Constants.displayPadCreationScreen]; var updateMeta = function () { + // TODO availableHashes in privateData may need updates once we have + // a better privileges workflow + //console.log('EV_METADATA_UPDATE'); var metaObj, isTemplate; nThen(function (waitFor) {