identicon fallback for fubar profile photo

This commit is contained in:
Martti Malmi 2022-06-21 18:40:21 +03:00
parent 093a83a920
commit 9d923a5d69
3 changed files with 5 additions and 5 deletions

View File

@ -94,12 +94,13 @@ class Identicon extends Component<Props, State> {
render() {
const width = this.props.width;
const activity = ['online', 'active'].indexOf(this.state.activity ?? '') > -1 ? this.state.activity : '';
const hasPhoto = this.state.photo && !this.props.hidePhoto ? 'has-photo' : '';
const hasPhoto = this.state.photo && !this.props.hidePhoto && this.state.photo.indexOf('data:image') === 0;
const hasPhotoStyle = hasPhoto ? 'has-photo' : '';
const showTooltip = this.props.showTooltip ? 'tooltip' : '';
return (
<div onClick={this.props.onClick} style={{position: 'relative', cursor: this.props.onClick ? 'pointer' : undefined}} class={`identicon-container ${hasPhoto} ${showTooltip} ${activity}`}>
<div onClick={this.props.onClick} style={{position: 'relative', cursor: this.props.onClick ? 'pointer' : undefined}} class={`identicon-container ${hasPhotoStyle} ${showTooltip} ${activity}`}>
<div style={{width: width, height: width}} class="identicon">
{(this.state.photo && !this.props.hidePhoto) ? <SafeImg src={this.state.photo} class="identicon-image" width={width}/> : null}
{hasPhoto ? <SafeImg src={this.state.photo} class="identicon-image" width={width}/> : null}
</div>
{this.props.showTooltip && this.state.name ? html`<span class="tooltiptext">${this.state.name}</span>` : ''}
{this.props.activity ? <div class="online-indicator"/> : null}

View File

@ -40,7 +40,6 @@ class Follows extends View {
console.log(user, following);
if (following) {
if (!following) return;
console.log(f);
this.follows[user] = f[user] || {};
this.setState({});
}

View File

@ -113,7 +113,7 @@ class Profile extends View {
let profilePhoto;
if (this.isMyProfile) {
profilePhoto = html`<${ProfilePhotoPicker} currentPhoto=${this.state.photo} placeholder=${this.props.id} callback=${src => this.onProfilePhotoSet(src)}/>`;
} else if (this.state.photo && !this.state.blocked) {
} else if (this.state.photo && !this.state.blocked && this.state.photo.indexOf('data:image') === 0) {
profilePhoto = html`<${SafeImg} class="profile-photo" src=${this.state.photo}/>`
} else {
profilePhoto = html`<${Identicon} str=${this.props.id} hidePhoto=${this.state.blocked} width=250/>`