diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 823f1b817..a3eb76857 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1152,10 +1152,10 @@ define([ var FILTER_BY = "filterBy"; - var refresh = APP.refresh = function () { + var refresh = APP.refresh = function (cb) { var type = APP.store[FILTER_BY]; var path = type ? [FILTER, type, currentPath] : currentPath; - APP.displayDirectory(path); + APP.displayDirectory(path, undefined, cb); }; // `app`: true (force open wiht the app), false (force open in preview), @@ -4290,10 +4290,12 @@ define([ appStatus.ready(true); }; - var displayDirectory = APP.displayDirectory = function (path, force) { + var displayDirectory = APP.displayDirectory = function (path, force, cb) { + cb = cb || function () {}; if (APP.closed || (APP.$content && !$.contains(document.documentElement, APP.$content[0]))) { return; } if (history.isHistoryMode) { - return void _displayDirectory(path, force); + _displayDirectory(path, force); + return void cb(); } if (!manager.comparePath(currentPath, path)) { removeSelected(); @@ -4302,6 +4304,7 @@ define([ copyObjectValue(files, proxy.drive); updateSharedFolders(sframeChan, manager, files, folders, function () { _displayDirectory(path, force); + cb(); }); }); }; @@ -5347,8 +5350,9 @@ define([ }; APP.FM = common.createFileManager(fmConfig); - refresh(); - UI.removeLoadingScreen(); + refresh(function () { + UI.removeLoadingScreen(); + }); /* if (!APP.team) { diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 6cbc8633f..597937fd3 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -335,11 +335,6 @@ define([ } }).nThen(function (waitFor) { var href = data.href; - var hashes = priv.hashes || {}; - var bestHash = hashes.editHash || hashes.viewHash || hashes.fileHash; - if (data.fakeHref) { - href = Hash.hashToHref(bestHash, priv.app); - } sel.forEach(function (el) { var curve = $(el).attr('data-curve'); if (curve === user.curvePublic) { return; } @@ -928,12 +923,7 @@ define([ } var href = data.href; - var hashes = priv.hashes || {}; - var bestHash = hashes.editHash || hashes.viewHash || hashes.fileHash; - if (data.fakeHref) { - href = Hash.hashToHref(bestHash, priv.app); - } - var isNotStored = Boolean(data.fakeHref); + var isNotStored = Boolean(data.isNotStored); sframeChan.query(q, { teamId: typeof(owned) !== "boolean" ? owned : undefined, href: href, @@ -1055,7 +1045,7 @@ define([ var owned = Modal.isOwned(Env, data); // Request edit access - if (common.isLoggedIn() && ((data.roHref && !data.href) || data.fakeHref) && !owned && !opts.calendar && priv.app !== 'form') { + if (common.isLoggedIn() && data.roHref && !owned && !opts.calendar && priv.app !== 'form') { var requestButton = h('button.btn.btn-secondary.no-margin.cp-access-margin-right', Messages.requestEdit_button); var requestBlock = h('p', requestButton); diff --git a/www/common/inner/common-modal.js b/www/common/inner/common-modal.js index 6d34747e2..2b6b874cf 100644 --- a/www/common/inner/common-modal.js +++ b/www/common/inner/common-modal.js @@ -42,11 +42,13 @@ define([ if (err || !val) { if (opts.access) { data.password = priv.password; - // Access modal and the pad is not stored: we're not an owner - // so we don't need the correct href, just the type - var h = Hash.createRandomHash(priv.app, priv.password); - data.fakeHref = true; - data.href = base + priv.pathname + '#' + h; + // Access modal and the pad is not stored: get the hashes from outer + var hashes = priv.hashes || {}; + data.href = Hash.hashToHref(hashes.editHash || hashes.fileHash, priv.app); + if (hashes.viewHash) { + data.roHref = Hash.hashToHref(hashes.viewHash, priv.app); + } + data.isNotStored = true; } else { waitFor.abort(); return void cb(err || 'EEMPTY'); diff --git a/www/common/inner/properties.js b/www/common/inner/properties.js index 0c5a05959..1fdf3e69f 100644 --- a/www/common/inner/properties.js +++ b/www/common/inner/properties.js @@ -37,20 +37,18 @@ define([ })); } - if (!data.fakeHref) { - if (data.href) { - $('