From 3a95a0d3eff964834ac5d24d23794da2b572c6fc Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Tue, 26 May 2026 14:12:01 +0200 Subject: [PATCH 1/8] #2275 shared folder opens correctly after login --- www/common/drive-ui.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 463e0a9c6..a4a8ae08c 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4357,6 +4357,7 @@ define([ // Display the selected directory into the content part (rightside) // NOTE: Elements in the trash are not using the same storage structure as the others var _displayDirectory = function (path, force) { + if (APP.closed || (APP.$content && !$.contains(document.documentElement, APP.$content[0]))) { return; } APP.hideMenu(); @@ -4376,6 +4377,12 @@ define([ } else { path = [ROOT]; } + } else if (driveConfig.APP.loggedIn && path[0] === 'sf') { + var fId = APP.newSharedFolder; + const key = Object.keys(proxy.drive.root).find( + k => proxy.drive.root[k] === parseInt(fId) + ); + path = ['root', String(key),'root']; } if (APP.loggedIn && path[0] === FILES_DATA) { From f0c9a2ca7d08944d9b4d0caf01ce73a5c76edd7c Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Wed, 15 Jul 2026 17:23:40 +0200 Subject: [PATCH 2/8] wip --- www/common/drive-ui.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index a4a8ae08c..6ae77acfc 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1274,6 +1274,10 @@ define([ var refresh = APP.refresh = function (cb, opt) { var type = APP.store[FILTER_BY]; var path = type ? [FILTER, type, currentPath] : currentPath; + if (APP.newSharedFolder && priv.anonSFHref && opt) { + opt.sf = true + } + APP.displayDirectory(path, undefined, () => { refreshDeprecated(); if (typeof(cb) === "function") { cb(); } @@ -4330,7 +4334,7 @@ define([ var $folderHeader = getFolderListHeader(true); var $fileHeader = getFileListHeader(true); var path = currentPath.slice(1); - var root = Util.find(data, path); + var root = Util.find(data, path) ? Util.find(data, path) : ['root']; var realPath = [ROOT, SHARED_FOLDER].concat(path); @@ -4377,11 +4381,13 @@ define([ } else { path = [ROOT]; } - } else if (driveConfig.APP.loggedIn && path[0] === 'sf') { + } else if (APP.loggedIn && path[0] === 'sf') { var fId = APP.newSharedFolder; - const key = Object.keys(proxy.drive.root).find( - k => proxy.drive.root[k] === parseInt(fId) - ); + + const key = Object.entries(proxy.drive.root).find( + ([_, value]) => value === Number(APP.newSharedFolder) + )?.[0]; + path = ['root', String(key),'root']; } @@ -4630,6 +4636,10 @@ define([ // _displayDirectory(path, force); // cb(); } + if (opt?.sf) { + path = ['sf', String(APP.newSharedFolder), 'root']; + + } updateSharedFolders(sframeChan, manager, files, folders, function () { _displayDirectory(path, force); fixTags(); From 2fad00b8fb9c820dbc0cfd56afdfdd6b86349031 Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Wed, 15 Jul 2026 17:26:31 +0200 Subject: [PATCH 3/8] wip --- www/common/drive-ui.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 6ae77acfc..7d7ca17aa 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4335,7 +4335,6 @@ define([ var $fileHeader = getFileListHeader(true); var path = currentPath.slice(1); var root = Util.find(data, path) ? Util.find(data, path) : ['root']; - var realPath = [ROOT, SHARED_FOLDER].concat(path); if (manager.hasSubfolder(root)) { $list.append($folderHeader); } From 748d2396174870b49a08556b717d8eda13682965 Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Thu, 16 Jul 2026 17:26:01 +0200 Subject: [PATCH 4/8] wip --- www/common/drive-ui.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 7d7ca17aa..83bac64f0 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1275,7 +1275,7 @@ define([ var type = APP.store[FILTER_BY]; var path = type ? [FILTER, type, currentPath] : currentPath; if (APP.newSharedFolder && priv.anonSFHref && opt) { - opt.sf = true + opt.sf = true; } APP.displayDirectory(path, undefined, () => { @@ -2767,6 +2767,7 @@ define([ path.forEach(function (p, idx) { if (isTrash && [2,3].indexOf(idx) !== -1) { return; } if (skipNext) { skipNext = false; return; } + if ( idx > 0 && p === ROOT && path[0] === SHARED_FOLDER ) { return; } if (APP.newSharedFolder && priv.isEmbed && p === ROOT && !idx) { return; } var name = p; @@ -2792,6 +2793,7 @@ define([ var $span = $('', {'class': 'cp-app-drive-path-element'}); if (idx < path.length - 1) { + if (!noStyle) { $span.addClass('cp-app-drive-path-clickable'); $span.click(function (e) { @@ -2805,6 +2807,7 @@ define([ name = getElementName(path); } $span.data("path", path.slice(0, idx + 1)); + addDragAndDropHandlers($span, path.slice(0, idx), true, true); if (idx === 0) { name = p === SHARED_FOLDER ? name : getPrettyName(p); } @@ -4334,7 +4337,7 @@ define([ var $folderHeader = getFolderListHeader(true); var $fileHeader = getFileListHeader(true); var path = currentPath.slice(1); - var root = Util.find(data, path) ? Util.find(data, path) : ['root']; + var root = Util.find(data, path) ? Util.find(data, path) : {}; var realPath = [ROOT, SHARED_FOLDER].concat(path); if (manager.hasSubfolder(root)) { $list.append($folderHeader); } @@ -4381,13 +4384,12 @@ define([ path = [ROOT]; } } else if (APP.loggedIn && path[0] === 'sf') { - var fId = APP.newSharedFolder; const key = Object.entries(proxy.drive.root).find( - ([_, value]) => value === Number(APP.newSharedFolder) + ([value]) => value === Number(APP.newSharedFolder) )?.[0]; - path = ['root', String(key),'root']; + path = ['root', String(key), 'root']; } if (APP.loggedIn && path[0] === FILES_DATA) { From bfcb1ccb98810e1b061e14f95524d83e710187aa Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Thu, 16 Jul 2026 17:40:51 +0200 Subject: [PATCH 5/8] cleaning --- www/common/drive-ui.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 83bac64f0..a84c1ec69 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2793,7 +2793,6 @@ define([ var $span = $('', {'class': 'cp-app-drive-path-element'}); if (idx < path.length - 1) { - if (!noStyle) { $span.addClass('cp-app-drive-path-clickable'); $span.click(function (e) { @@ -2807,7 +2806,6 @@ define([ name = getElementName(path); } $span.data("path", path.slice(0, idx + 1)); - addDragAndDropHandlers($span, path.slice(0, idx), true, true); if (idx === 0) { name = p === SHARED_FOLDER ? name : getPrettyName(p); } @@ -4363,7 +4361,6 @@ define([ // Display the selected directory into the content part (rightside) // NOTE: Elements in the trash are not using the same storage structure as the others var _displayDirectory = function (path, force) { - if (APP.closed || (APP.$content && !$.contains(document.documentElement, APP.$content[0]))) { return; } APP.hideMenu(); @@ -4386,7 +4383,7 @@ define([ } else if (APP.loggedIn && path[0] === 'sf') { const key = Object.entries(proxy.drive.root).find( - ([value]) => value === Number(APP.newSharedFolder) + ([key, value]) => value === Number(APP.newSharedFolder) )?.[0]; path = ['root', String(key), 'root']; From 28a7852351607cb62469cb7295b28ffb051f8d28 Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Tue, 21 Jul 2026 18:05:49 +0200 Subject: [PATCH 6/8] #2337 shared folders removed correctly --- www/common/sframe-common-outer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index e95389659..edbe2fbed 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -2335,7 +2335,7 @@ define([ // If our channel was deleted from all of our drives, sitch back to full hash // in the address bar Cryptpad.padRpc.onChannelDeleted.reg(function (channel) { - if (channel !== secret.channel) { return; } + if (channel !== secret.channel || currentPad.app === 'drive') { return; } Cryptpad.setTabHref(currentPad.href); }); From a0055c21614d747bc6a8e42bfe22e6f19a664e9a Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Tue, 21 Jul 2026 18:22:57 +0200 Subject: [PATCH 7/8] linting --- www/common/drive-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index a84c1ec69..3aa5d5fe8 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4383,7 +4383,7 @@ define([ } else if (APP.loggedIn && path[0] === 'sf') { const key = Object.entries(proxy.drive.root).find( - ([key, value]) => value === Number(APP.newSharedFolder) + ([, value]) => value === Number(APP.newSharedFolder) )?.[0]; path = ['root', String(key), 'root']; From 32d7acde5058923b06bc6494591b61162d631bf2 Mon Sep 17 00:00:00 2001 From: Zuzanna Ludzik Date: Mon, 3 Aug 2026 13:27:45 +0200 Subject: [PATCH 8/8] corrections --- www/common/drive-ui.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 3aa5d5fe8..e89f98f93 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1274,9 +1274,9 @@ define([ var refresh = APP.refresh = function (cb, opt) { var type = APP.store[FILTER_BY]; var path = type ? [FILTER, type, currentPath] : currentPath; - if (APP.newSharedFolder && priv.anonSFHref && opt) { - opt.sf = true; - } + if (APP.newSharedFolder && priv.anonSFHref && opt) { + opt.sf = true; + } APP.displayDirectory(path, undefined, () => { refreshDeprecated(); @@ -4335,7 +4335,7 @@ define([ var $folderHeader = getFolderListHeader(true); var $fileHeader = getFileListHeader(true); var path = currentPath.slice(1); - var root = Util.find(data, path) ? Util.find(data, path) : {}; + var root = Util.find(data, path) || {}; var realPath = [ROOT, SHARED_FOLDER].concat(path); if (manager.hasSubfolder(root)) { $list.append($folderHeader); }