Show group name in flair tooltip if one is set
e.g. "Group Name (+group_id:homeserver)" or "+group_id:homeserver" Fixes https://github.com/vector-im/riot-web/issues/5341pull/21833/head
parent
be5e67245b
commit
9027780215
|
@ -43,18 +43,22 @@ class FlairAvatar extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const httpUrl = this.context.matrixClient.mxcUrlToHttp(
|
const httpUrl = this.context.matrixClient.mxcUrlToHttp(
|
||||||
this.props.groupProfile.avatarUrl, 16, 16, 'scale', false);
|
this.props.groupProfile.avatarUrl, 16, 16, 'scale', false);
|
||||||
|
const tooltip = this.props.groupProfile.name ?
|
||||||
|
`${this.props.groupProfile.name} (${this.props.groupProfile.groupId})`:
|
||||||
|
this.props.groupProfile.groupId;
|
||||||
return <img
|
return <img
|
||||||
src={httpUrl}
|
src={httpUrl}
|
||||||
width="16"
|
width="16"
|
||||||
height="16"
|
height="16"
|
||||||
onClick={this.onClick}
|
onClick={this.onClick}
|
||||||
title={this.props.groupProfile.groupId} />;
|
title={tooltip} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlairAvatar.propTypes = {
|
FlairAvatar.propTypes = {
|
||||||
groupProfile: PropTypes.shape({
|
groupProfile: PropTypes.shape({
|
||||||
groupId: PropTypes.string.isRequired,
|
groupId: PropTypes.string.isRequired,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
avatarUrl: PropTypes.string.isRequired,
|
avatarUrl: PropTypes.string.isRequired,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue