diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 9ffadea3c..95d5b872e 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -213,6 +213,19 @@ define([ } }; + // Make sure a former tab on the same worker doesn't have remaining locks + var checkClients = function (clients) { + Object.keys(content.ids).forEach(function (id) { + var tabId = Number(id.slice(33)); // remove the netflux ID and the "-" + if (clients.indexOf(tabId) === -1) { + removeClient({ + id: tabId + }); + } + }); + }; + + var getFileType = function () { var type = common.getMetadataMgr().getPrivateData().ooType; var title = common.getMetadataMgr().getMetadataLazy().title; @@ -728,6 +741,7 @@ define([ sframeChan.on('EV_OO_EVENT', function (obj) { switch (obj.ev) { case 'READY': + checkClients(obj.data); cb(); break; case 'LEAVE': @@ -1357,6 +1371,7 @@ define([ } catch (e) {} } else { setEditable(true); + handleNewLocks({}, content.locks); if (APP.unsavedChanges) { varĀ unsaved = APP.unsavedChanges; delete APP.unsavedChanges; diff --git a/www/common/outer/onlyoffice.js b/www/common/outer/onlyoffice.js index 773774c5a..b5c3e7ba1 100644 --- a/www/common/outer/onlyoffice.js +++ b/www/common/outer/onlyoffice.js @@ -40,7 +40,7 @@ define([ if (!c.id) { c.id = chan.wc.myID + '-' + client; } getHistory(ctx, client, function () { - ctx.emit('READY', '', [client]); + ctx.emit('READY', chan.clients, [client]); }); // ==> And push the new tab to the list @@ -149,7 +149,7 @@ define([ } // End of history: emit READY if (parsed.state && parsed.state === 1 && parsed.channel) { - ctx.emit('READY', '', chan.clients); + ctx.emit('READY', chan.clients, chan.clients); return; } if (parsed.error && parsed.channel) { return; }