Fix avatar in read-only mode (secure pads)

pull/1/head
yflory 7 years ago
parent 88cb4fd83c
commit 00fda0d7d7

@ -43,7 +43,6 @@ define([
$container.append($avatar); $container.append($avatar);
if (cb) { cb(); } if (cb) { cb(); }
}; };
if (!href) { return void displayDefault(); } if (!href) { return void displayDefault(); }
var parsed = Cryptpad.parsePadUrl(href); var parsed = Cryptpad.parsePadUrl(href);
var secret = Cryptpad.getSecrets('file', parsed.hash); var secret = Cryptpad.getSecrets('file', parsed.hash);
@ -210,19 +209,17 @@ define([
var $avatar = $userAdmin.find('.buttonTitle'); var $avatar = $userAdmin.find('.buttonTitle');
var updateButton = function () { var updateButton = function () {
var myData = metadataMgr.getMetadata().users[metadataMgr.getNetfluxId()]; var myData = metadataMgr.getUserData();
if (!myData) { return; } if (!myData) { return; }
var newName = myData.name; var newName = myData.name;
var url = myData.avatar; var url = myData.avatar;
$displayName.text(newName || Messages.anonymous); $displayName.text(newName || Messages.anonymous);
if (accountName) {
$avatar.html(''); $avatar.html('');
UI.displayAvatar(Common, $avatar, url, newName, function ($img) { UI.displayAvatar(Common, $avatar, url, newName, function ($img) {
if ($img) { if ($img) {
$userAdmin.find('button').addClass('avatar'); $userAdmin.find('button').addClass('avatar');
} }
}); });
}
}; };
metadataMgr.onChange(updateButton); metadataMgr.onChange(updateButton);
updateButton(); updateButton();

Loading…
Cancel
Save