diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index a14bb2050..35ab93cda 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2505,6 +2505,9 @@ define([ } else if (err.type === 'ERESTRICTED') { msg = Messages.restrictedError; if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); } + } else if (err.type === 'HASH_NOT_FOUND' && priv.isHistoryVersion) { + msg = Messages.oo_deletedVersion; + if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); } } var sframeChan = common.getSframeChannel(); sframeChan.event('EV_SHARE_OPEN', {hidden: true}); @@ -3407,6 +3410,7 @@ define([ }); make(val, function (err) { clearTimeout(to); + $input.val(''); if (err) { return void UI.alert(Messages.snapshots_cantMake); } diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index fc98fe22d..4b16dfe2b 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -340,6 +340,7 @@ define([ if (!val) { return true; } config.makeSnapshot(val, function (err) { if (err) { return; } + $input.val(''); UI.log(Messages.saved); }, { hash: getVersion(), diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 36e88f067..df05d8a3e 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1470,6 +1470,11 @@ define([ Store.getPadMetadata(null, { channel: data.channel }, waitFor(function (md) { + if (md && md.rejected) { + postMessage(clientId, "PAD_ERROR", {type: "ERESTRICTED"}); + waitFor.abort(); + return; + } validateKey = md.validateKey; })); }).nThen(function () { @@ -1482,6 +1487,11 @@ define([ postMessage(clientId, "PAD_ERROR", obj.error); return; } + var msgs = obj.messages || []; + if (msgs.length && msgs[msgs.length - 1].serverHash !== data.versionHash) { + postMessage(clientId, "PAD_ERROR", {type: "HASH_NOT_FOUND"}); + return; + } postMessage(clientId, "PAD_CONNECT", { myID: fakeNetflux, id: data.channel, diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index d171bcef4..85d3d35bb 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -407,6 +407,7 @@ define([ }; var sent = config.setLastMetadata(md); if (!sent) { return void UI.alert(Messages.snapshots_cantMake); } + $input.val(''); refreshBar(); } catch (e) { console.error(e);