From 9027780215512d5e05ba9bacd4137d013a5861a5 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 9 Nov 2017 12:38:43 +0000 Subject: [PATCH] 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/5341 --- src/components/views/elements/Flair.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/Flair.js b/src/components/views/elements/Flair.js index 69d9aa35b7..82a96ff11f 100644 --- a/src/components/views/elements/Flair.js +++ b/src/components/views/elements/Flair.js @@ -43,18 +43,22 @@ class FlairAvatar extends React.Component { render() { const httpUrl = this.context.matrixClient.mxcUrlToHttp( 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 ; + title={tooltip} />; } } FlairAvatar.propTypes = { groupProfile: PropTypes.shape({ groupId: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, avatarUrl: PropTypes.string.isRequired, }), };