Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 74c6ebc

Browse files
authored
Merge pull request #1595 from matrix-org/luke/groups-show-user-profile-on-action
Display group member profile (avatar/displayname) in ConfirmUserActionDialog
2 parents d2549b6 + d179267 commit 74c6ebc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/views/dialogs/ConfirmUserActionDialog.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import React from 'react';
18+
import { MatrixClient } from 'matrix-js-sdk';
1819
import sdk from '../../../index';
1920
import { _t } from '../../../languageHandler';
2021
import classnames from 'classnames';
@@ -35,6 +36,8 @@ export default React.createClass({
3536
member: React.PropTypes.object,
3637
// group member object. Supply either this or 'member'
3738
groupMember: GroupMemberType,
39+
// needed if a group member is specified
40+
matrixClient: React.PropTypes.instanceOf(MatrixClient),
3841
action: React.PropTypes.string.isRequired, // eg. 'Ban'
3942
title: React.PropTypes.string.isRequired, // eg. 'Ban this user?'
4043

@@ -104,10 +107,11 @@ export default React.createClass({
104107
name = this.props.member.name;
105108
userId = this.props.member.userId;
106109
} else {
107-
// we don't get this info from the API yet
108-
avatar = <BaseAvatar name={this.props.groupMember.userId} width={48} height={48} />;
109-
name = this.props.groupMember.userId;
110+
const httpAvatarUrl = this.props.groupMember.avatarUrl ?
111+
this.props.matrixClient.mxcUrlToHttp(this.props.groupMember.avatarUrl, 48, 48) : null;
112+
name = this.props.groupMember.displayname || this.props.groupMember.userId;
110113
userId = this.props.groupMember.userId;
114+
avatar = <BaseAvatar name={name} url={httpAvatarUrl} width={48} height={48} />;
111115
}
112116

113117
return (

src/components/views/groups/GroupMemberInfo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module.exports = React.createClass({
8383
_onKick: function() {
8484
const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog");
8585
Modal.createDialog(ConfirmUserActionDialog, {
86+
matrixClient: this.context.matrixClient,
8687
groupMember: this.props.groupMember,
8788
action: this.state.isUserInvited ? _t('Disinvite') : _t('Remove from community'),
8889
title: this.state.isUserInvited ? _t('Disinvite this user from community?')

0 commit comments

Comments
 (0)