From 41a9ff22fbbcea2eb2a96071e54afc4d967a2cee Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 21 Sep 2017 14:22:43 +0100 Subject: [PATCH] Rename profile object properties to camelCase Also, add correct PropTypes for FlairAvatar --- src/components/views/elements/Flair.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/views/elements/Flair.js b/src/components/views/elements/Flair.js index bb72786073..cce115dc45 100644 --- a/src/components/views/elements/Flair.js +++ b/src/components/views/elements/Flair.js @@ -121,8 +121,11 @@ async function getGroupProfileCached(matrixClient, groupId) { return groupProfiles[groupId]; } - groupProfiles[groupId] = await matrixClient.getGroupProfile(groupId); - groupProfiles[groupId].group_id = groupId; + const profile = await matrixClient.getGroupProfile(groupId); + groupProfiles[groupId] = { + groupId, + avatarUrl: profile.avatar_url, + }; return groupProfiles[groupId]; } @@ -139,19 +142,22 @@ class FlairAvatar extends React.Component { ev.stopPropagation(); dis.dispatch({ action: 'view_group', - group_id: this.props.groupProfile.group_id, + group_id: this.props.groupProfile.groupId, }); } render() { const httpUrl = this.context.matrixClient.mxcUrlToHttp( - this.props.groupProfile.avatar_url, 14, 14, 'scale', false); + this.props.groupProfile.avatarUrl, 14, 14, 'scale', false); return ; } } FlairAvatar.propTypes = { - groupProfile: PropTypes.string, + groupProfile: PropTypes.shape({ + groupId: PropTypes.string.isRequired, + avatarUrl: PropTypes.string.isRequired, + }), }; FlairAvatar.contextTypes = {