Fix User menu and link to drive in anonymous shared folders

pull/1/head
yflory 6 years ago
parent d78a00b5e1
commit 9a6e6f6e15

@ -1513,8 +1513,9 @@ define([
var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name'; var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name';
var $displayedName = $('<span>', {'class': displayNameCls}); var $displayedName = $('<span>', {'class': displayNameCls});
var accountName = metadataMgr.getPrivateData().accountName; var priv = metadataMgr.getPrivateData();
var origin = metadataMgr.getPrivateData().origin; var accountName = priv.accountName;
var origin = priv.origin;
var padType = metadataMgr.getMetadata().type; var padType = metadataMgr.getMetadata().type;
var $userName = $('<span>'); var $userName = $('<span>');
@ -1538,7 +1539,7 @@ define([
content: $userAdminContent.html() content: $userAdminContent.html()
}); });
} }
if (padType !== 'drive') { if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: { attributes: {

@ -729,8 +729,12 @@ Messenger, MessengerUI, Messages) {
var privateData = config.metadataMgr.getPrivateData(); var privateData = config.metadataMgr.getPrivateData();
var origin = privateData.origin; var origin = privateData.origin;
var pathname = privateData.pathname; 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 = $('<a>', { var $aTag = $('<a>', {
href: href, href: href,

@ -385,15 +385,11 @@ define([
e.stopPropagation(); e.stopPropagation();
}); });
// TOOLBAR // TOOLBAR
/* add a "change username" button */ /* add a "change username" button */
if (!APP.readOnly) { if (!APP.readOnly) {
APP.$displayName.text(user.name || Messages.anonymous); APP.$displayName.text(user.name || Messages.anonymous);
} else {
APP.$displayName.html('<span class="' + Toolbar.constants.readonly + '">' + Messages.readonly + '</span>');
} }
// FILE MANAGER // FILE MANAGER
@ -3559,7 +3555,7 @@ define([
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'], displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'],
pageTitle: pageTitle, pageTitle: pageTitle,
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: readOnly, readOnly: privateData.readOnly,
sfCommon: common, sfCommon: common,
$container: APP.$bar $container: APP.$bar
}; };

Loading…
Cancel
Save