diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 8bf50bb3b..78510b6dd 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1204,8 +1204,6 @@ define([ hide.push('collapseall'); } containsFolder = true; - hide.push('share'); // XXX CONVERT - hide.push('savelocal'); // XXX CONVERT hide.push('openro'); hide.push('openincode'); hide.push('properties'); @@ -4054,8 +4052,7 @@ define([ if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder // if folder is inside SF - return UI.warn('ERROR: Temporarily disabled'); // XXX CONVERT - /*if (manager.isInSharedFolder(paths[0].path)) { + if (manager.isInSharedFolder(paths[0].path)) { return void UI.alert(Messages.convertFolderToSF_SFParent); } // if folder already contains SF @@ -4085,7 +4082,7 @@ define([ var owned = Util.isChecked($(convertContent).find('#cp-upload-owned')); manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh); }); - }*/ + } } else { // File var sf = manager.isSharedFolder(el); data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el); diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index 67ce14816..2fa3751f7 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -587,14 +587,10 @@ define([ // convert a folder to a Shared Folder var _convertFolderToSharedFolder = function (Env, data, cb) { - return void cb({ - error: 'DISABLED' - }); // XXX CONVERT - /*var path = data.path; + var path = data.path; var folderElement = Env.user.userObject.find(path); // don't try to convert top-level elements (trash, root, etc) to shared-folders - // TODO also validate that you're in root (not templates, etc) - if (data.path.length <= 1) { + if (path.length <= 1 || path[0] !== UserObject.ROOT) { return void cb({ error: 'E_INVAL_PATH', }); @@ -664,6 +660,21 @@ define([ newPath: newPath, copy: false, }, waitFor()); + }).nThen(function (waitFor) { + // Move the owned pads from the old folder to root + var paths = []; + Object.keys(folderElement).forEach(function (el) { + if (!Env.user.userObject.isFile(folderElement[el])) { return; } + var data = Env.user.userObject.getFileData(folderElement[el]); + if (!data || !_ownedByMe(Env, data.owners)) { return; } + // This is an owned pad: move it to ROOT before deleting the initial folder + paths.push(path.concat(el)); + }); + _move(Env, { + paths: paths, + newPath: [UserObject.ROOT], + copy: false, + }, waitFor()); }).nThen(function () { // migrate metadata var sharedFolderElement = Env.user.proxy[UserObject.SHARED_FOLDERS][SFId]; @@ -680,7 +691,7 @@ define([ Env.user.userObject.delete([path], function () { cb(); }); - });*/ + }); }; // Delete permanently some pads or folders