When importing a shared folder to the drive, open this folder directly

pull/1/head
yflory 6 years ago
parent 630a2dab78
commit e0b7f3f965

@ -269,6 +269,9 @@ define([
channel: secret.channel, channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1" // TODO to remove when enabled by default enableSF: localStorage.CryptPad_SF === "1" // TODO to remove when enabled by default
}; };
if (window.CryptPad_newSharedFolder) {
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;
}
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; } for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
if (cfg.addData) { if (cfg.addData) {

@ -388,6 +388,13 @@ define([
// FILE MANAGER // FILE MANAGER
var currentPath = APP.currentPath = getLastOpenedFolder(); var currentPath = APP.currentPath = getLastOpenedFolder();
if (APP.newSharedFolder) {
var newSFPaths = manager.findFile(APP.newSharedFolder);
if (newSFPaths.length) {
currentPath = newSFPaths[0];
}
}
// Categories dislayed in the menu // Categories dislayed in the menu
var displayedCategories = [ROOT, TRASH, SEARCH, RECENT]; var displayedCategories = [ROOT, TRASH, SEARCH, RECENT];
@ -3362,8 +3369,12 @@ define([
}).nThen(function () { }).nThen(function () {
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
APP.disableSF = !metadataMgr.getPrivateData().enableSF && AppConfig.disableSharedFolders; if (privateData.newSharedFolder) {
APP.newSharedFolder = privateData.newSharedFolder;
}
APP.disableSF = !privateData.enableSF && AppConfig.disableSharedFolders;
var configTb = { var configTb = {
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'], displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'],

@ -42,8 +42,14 @@ define([
if (hash) { if (hash) {
// Add a shared folder! // Add a shared folder!
// XXX password? // XXX password?
Cryptpad.addSharedFolder(secret, function () { Cryptpad.addSharedFolder(secret, function (id) {
window.CryptPad_newSharedFolder = id;
// Update the hash in the address bar
var ohc = window.onhashchange;
window.onhashchange = function () {};
window.location.hash = ""; window.location.hash = "";
window.onhashchange = ohc;
ohc({reset:true});
cb(null, secret); cb(null, secret);
}); });
return; return;

Loading…
Cancel
Save