diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 880c4c354..1e320c100 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1601,14 +1601,9 @@ define([ .text(Messages.accessButton)) .click(common.prepareFeedback(type)) .click(function () { - common.isPadStored(function (err, data) { // XXX not necessary for access modal? - if (!data) { - return void UI.alert(Messages.autostore_notAvailable); - } - require(['/common/inner/access.js'], function (Access) { - Access.getAccessModal(common, {}, function (e) { - if (e) { console.error(e); } - }); + require(['/common/inner/access.js'], function (Access) { + Access.getAccessModal(common, {}, function (e) { + if (e) { console.error(e); } }); }); }); diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 87585e501..611b42255 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -1000,6 +1000,7 @@ define([ cb = cb || function () {}; opts = opts || {}; opts.wide = true; + opts.access = true; var tabs = [{ getTab: getAccessTab, title: Messages.access_main, diff --git a/www/common/inner/common-modal.js b/www/common/inner/common-modal.js index 783775b6e..ee475c028 100644 --- a/www/common/inner/common-modal.js +++ b/www/common/inner/common-modal.js @@ -1,11 +1,12 @@ define([ 'jquery', '/common/common-util.js', + '/common/common-hash.js', '/common/common-interface.js', '/common/common-ui-elements.js', '/customize/messages.js', '/bower_components/nthen/index.js', -], function ($, Util, UI, UIElements, Messages, nThen) { +], function ($, Util, Hash, UI, UIElements, Messages, nThen) { var Modal = {}; Modal.override = function (data, obj) { @@ -23,7 +24,7 @@ define([ }, waitFor(function (md) { if (md && md.error) { return void console.error(md.error); } Modal.override(data, md); - if (redraw) { Env.evRedrawAll.fire(redraw); } // XXX + if (redraw) { Env.evRedrawAll.fire(redraw); } })); }; Modal.getPadData = function (Env, opts, _cb) { @@ -32,11 +33,21 @@ define([ opts = opts || {}; var data = {}; nThen(function (waitFor) { - var base = common.getMetadataMgr().getPrivateData().origin; + var priv = common.getMetadataMgr().getPrivateData(); + var base = priv.origin; common.getPadAttribute('', waitFor(function (err, val) { if (err || !val) { - waitFor.abort(); - return void cb(err || 'EEMPTY'); + 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.href = base + priv.pathname + '#' + h; + } else { + waitFor.abort(); + return void cb(err || 'EEMPTY'); + } + return; } if (!val.fileType) { delete val.owners; diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index df81be9fd..7024bcfe3 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -103,7 +103,7 @@ define([ sframeChan.on('EV_RT_ERROR', function (err) { isReady = false; chainpad.abort(); - if (err.type === 'EUNKNOWN') { // XXX + if (err.type === 'EUNKNOWN') { // Recoverable error: make a new chainpad chainpad = makeChainPad(); return;