refactor: helpers.buildAvatar now renders both avatars, and hides the second one using CSS

This commit is contained in:
Julian Lam
2022-09-29 16:00:53 -04:00
parent f58e1cda30
commit ab157136aa
2 changed files with 10 additions and 2 deletions

View File

@@ -99,6 +99,10 @@
&.avatar-rounded {
border-radius: 50%;
}
&+.avatar {
display: none;
}
}
.ban-modal {

View File

@@ -278,19 +278,23 @@ module.exports = function (utils, Benchpress, relative_path) {
attributes.unshift(`class="avatar ${classNames}${rounded ? ' avatar-rounded' : ''}"`);
// Component override
// Component override -- FIXME
if (component) {
attributes.push('component="' + component + '"');
} else {
attributes.push('component="avatar/' + (userObj.picture ? 'picture' : 'icon') + '"');
}
let output = '';
if (userObj.picture) {
return '<img ' + attributes.join(' ') + ' src="' + userObj.picture + '" style="' + styles.join(' ') + '" />';
}
styles.push('background-color: ' + userObj['icon:bgColor'] + ';');
return '<span ' + attributes.join(' ') + ' style="' + styles.join(' ') + '">' + userObj['icon:text'] + '</span>';
output += '<span ' + attributes.join(' ') + ' style="' + styles.join(' ') + '">' + userObj['icon:text'] + '</span>';
return output;
}
function register() {