From 3658fe93de6c3cdb90dc1ccba19c06df55f4c2c2 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 7 Dec 2021 07:32:01 +0530 Subject: [PATCH 1/2] prompt guests to register or log in when viewing editable shared folders --- www/common/drive-ui.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 555301268..da3811c0c 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -3907,7 +3907,17 @@ define([ setEditable(true, false, true); } - if (APP.readOnly) { + if (APP.readOnly && !APP.loggedIn) { + (function () { + var $banner = $(Pages.setHTML(h('div.cp-app-drive-content-info-box'), Messages.fm_info_sharedFolder)); + $banner.find('[href="/login/"], [href="/register/"]').click(function (ev) { + ev.preventDefault(); + var page = this.getAttribute('href').replace(/\//g, ''); + common.setLoginRedirect(page); + }); + $content.prepend($banner); + }()); + } else if (APP.readOnly) { // Read-only drive (team?) $content.prepend($readOnly.clone()); } else if (sfId && folders[sfId] && folders[sfId].readOnly) { From 92e3527552cdb27cd1854625d0cb88d64a982668 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 7 Dec 2021 09:06:18 +0530 Subject: [PATCH 2/2] leave a note to fix an unhandled case with read-only shared folders for guests --- www/common/drive-ui.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index da3811c0c..6fbc381b7 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -3908,6 +3908,7 @@ define([ } if (APP.readOnly && !APP.loggedIn) { + // XXX this incorrectly prompts guests to login/register even when they lack editing rights. (function () { var $banner = $(Pages.setHTML(h('div.cp-app-drive-content-info-box'), Messages.fm_info_sharedFolder)); $banner.find('[href="/login/"], [href="/register/"]').click(function (ev) {