diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 980e8ecb97..caa5e7cb01 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -430,6 +430,7 @@ export default React.createClass({ uploadingAvatar: false, membershipBusy: false, publicityBusy: false, + inviterProfile: null, }; }, @@ -463,6 +464,10 @@ export default React.createClass({ }, _initGroupStore: function(groupId, firstInit) { + const group = MatrixClientPeg.get().getGroup(groupId); + if (group && group.inviter && group.inviter.userId) { + this._fetchInviterProfile(group.inviter.userId); + } this._groupStore = GroupStoreCache.getGroupStore(MatrixClientPeg.get(), groupId); this._groupStore.registerListener(() => { const summary = this._groupStore.getSummary(); @@ -497,6 +502,26 @@ export default React.createClass({ }); }, + _fetchInviterProfile(userId) { + this.setState({ + inviterProfileBusy: true, + }); + MatrixClientPeg.get().getProfileInfo(userId).then((resp) => { + this.setState({ + inviterProfile: { + avatarUrl: resp.avatar_url, + displayName: resp.displayname, + }, + }); + }).catch((e) => { + console.error('Error getting group inviter profile', e); + }).finally(() => { + this.setState({ + inviterProfileBusy: false, + }); + }); + }, + _onShowRhsClick: function(ev) { dis.dispatch({ action: 'show_right_panel' }); }, @@ -802,20 +827,37 @@ export default React.createClass({ _getMembershipSection: function() { const Spinner = sdk.getComponent("elements.Spinner"); + const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); const group = MatrixClientPeg.get().getGroup(this.props.groupId); if (!group) return null; if (group.myMembership === 'invite') { - if (this.state.membershipBusy) { + if (this.state.membershipBusy || this.state.inviterProfileBusy) { return