Test improved lock

pull/1/head
yflory 4 years ago
parent 5defa729e7
commit 2172e1405c

@ -989,6 +989,7 @@ define([
deleteOfflineLocks(); deleteOfflineLocks();
// Prepare callback // Prepare callback
if (cpNfInner) { if (cpNfInner) {
APP.waitLock = Util.mkEvent(true);
var onPatchSent = function (again) { var onPatchSent = function (again) {
if (!again) { cpNfInner.offPatchSent(onPatchSent); } if (!again) { cpNfInner.offPatchSent(onPatchSent); }
// Answer to our onlyoffice // Answer to our onlyoffice
@ -1004,6 +1005,8 @@ define([
type: "getLock", type: "getLock",
locks: getLock() locks: getLock()
}); });
APP.waitLock.fire();
delete APP.waitLock;
} else { } else {
if (!isLockedModal.modal) { if (!isLockedModal.modal) {
isLockedModal.modal = UI.openCustomModal(isLockedModal.content); isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
@ -1127,10 +1130,19 @@ define([
case "isSaveLock": case "isSaveLock":
// TODO ping the server to check if we're online first? // TODO ping the server to check if we're online first?
if (!offline) { if (!offline) {
send({ if (APP.waitLock) {
type: "saveLock", APP.waitLock.reg(function () {
saveLock: false send({
}, true); type: "saveLock",
saveLock: false
}, true);
});
} else {
send({
type: "saveLock",
saveLock: false
}, true);
}
} }
break; break;
case "getLock": case "getLock":

Loading…
Cancel
Save