From e1119290df849e97af71f99681af601f5cfc19a2 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 18 Mar 2020 14:47:33 +0100 Subject: [PATCH] Better lock message --- www/common/common-interface.js | 1 + www/common/onlyoffice/inner.js | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 6f9b4bed2..d7fafec99 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -458,6 +458,7 @@ define([ setTimeout(function () { Notifier.notify(); }); + return frame; }; UI.alert = function (msg, cb, opt) { diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index e112fed35..43ec06b82 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -531,6 +531,9 @@ define([ delete content.locks[id]; } }); + if (content.saveLock && !isUserOnline(content.saveLock)) { + delete content.saveLock; + } }; var handleAuth = function (obj, send) { @@ -595,9 +598,16 @@ define([ }; // Add a lock + var isLockedModal = { + content: UI.customModal(h('div', [ + h('span.fa.fa-spin.fa-spinner'), + "pewpewpew" + ])) var handleLock = function (obj, send) { if (content.saveLock) { - if (Messages.oo_isLocked) { UI.log(Messages.oo_isLocked); } + if (!isLockedModal.modal) { + isLockedModal.modal = UI.openCustomModal(isLockedModal.content); + } setTimeout(function () { handleLock(obj, send); }, 50); @@ -621,12 +631,18 @@ define([ if (!again) { cpNfInner.offPatchSent(onPatchSent); } // Answer to our onlyoffice if (!content.saveLock) { + if (isLockedModal.modal) { + isLockedModal.modal.closeModal(); + delete isLockedModal.modal(); + } send({ type: "getLock", locks: getLock() }); } else { - if (Messages.oo_isLocked) { UI.log(Messages.oo_isLocked); } + if (!isLockedModal.modal) { + isLockedModal.modal = UI.openCustomModal(isLockedModal.content); + } setTimeout(function () { onPatchSent(true); }, 50);