From 9a6e6f6e157ce7a7d7e45ac096f27a56c01b4bf6 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 1 Oct 2018 18:24:08 +0200 Subject: [PATCH] Fix User menu and link to drive in anonymous shared folders --- www/common/common-ui-elements.js | 7 ++++--- www/common/toolbar3.js | 8 ++++++-- www/drive/inner.js | 6 +----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 41caf857f..1f7884110 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1513,8 +1513,9 @@ define([ var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name'; var $displayedName = $('', {'class': displayNameCls}); - var accountName = metadataMgr.getPrivateData().accountName; - var origin = metadataMgr.getPrivateData().origin; + var priv = metadataMgr.getPrivateData(); + var accountName = priv.accountName; + var origin = priv.origin; var padType = metadataMgr.getMetadata().type; var $userName = $(''); @@ -1538,7 +1539,7 @@ define([ content: $userAdminContent.html() }); } - if (padType !== 'drive') { + if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) { options.push({ tag: 'a', attributes: { diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index ac390400b..976bd6303 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -729,8 +729,12 @@ Messenger, MessengerUI, Messages) { var privateData = config.metadataMgr.getPrivateData(); var origin = privateData.origin; var pathname = privateData.pathname; - var href = inDrive.test(pathname) ? origin+'/index.html' : origin+'/drive/'; - var buttonTitle = inDrive.test(pathname) ? Messages.header_homeTitle : Messages.header_logoTitle; + + var isAnonSF = privateData.newSharedFolder && !privateData.accountName; + var toMain = inDrive.test(pathname) && !isAnonSF; + + var href = toMain ? origin+'/index.html' : origin+'/drive/'; + var buttonTitle = toMain ? Messages.header_homeTitle : Messages.header_logoTitle; var $aTag = $('', { href: href, diff --git a/www/drive/inner.js b/www/drive/inner.js index 80634bd67..7b908536e 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -385,15 +385,11 @@ define([ e.stopPropagation(); }); - - // TOOLBAR /* add a "change username" button */ if (!APP.readOnly) { APP.$displayName.text(user.name || Messages.anonymous); - } else { - APP.$displayName.html('' + Messages.readonly + ''); } // FILE MANAGER @@ -3559,7 +3555,7 @@ define([ displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'], pageTitle: pageTitle, metadataMgr: metadataMgr, - readOnly: readOnly, + readOnly: privateData.readOnly, sfCommon: common, $container: APP.$bar };