From a8487c540f01a4cf63f4500b28f3af3441733b5c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 9 Nov 2017 14:34:04 +0000 Subject: [PATCH] Convert group avatar URL to HTTP before handing to BaseAvatar This is yet another component that imports the MatrixClient just for mxcUrlToHttp. It'd be much nicer to have an avatar component that accepted MXCs, e.g. by wrapping or modifying BaseAvatar. --- src/components/views/groups/GroupInviteTile.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/views/groups/GroupInviteTile.js b/src/components/views/groups/GroupInviteTile.js index 508788d1c7..d97464e8ca 100644 --- a/src/components/views/groups/GroupInviteTile.js +++ b/src/components/views/groups/GroupInviteTile.js @@ -16,6 +16,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; +import { MatrixClient } from 'matrix-js-sdk'; import sdk from '../../../index'; import dis from '../../../dispatcher'; import AccessibleButton from '../elements/AccessibleButton'; @@ -27,6 +28,10 @@ export default React.createClass({ group: PropTypes.object.isRequired, }, + contextTypes: { + matrixClient: PropTypes.instanceOf(MatrixClient), + }, + onClick: function(e) { dis.dispatch({ action: 'view_group', @@ -39,8 +44,10 @@ export default React.createClass({ const EmojiText = sdk.getComponent('elements.EmojiText'); const groupName = this.props.group.name || this.props.group.groupId; + const httpAvatarUrl = this.props.group.avatarUrl ? + this.context.matrixClient.mxcUrlToHttp(this.props.group.avatarUrl, 24, 24) : null; - const av = ; + const av = ; const label =