mirror of https://github.com/vector-im/riot-web
Merge pull request #1595 from matrix-org/luke/groups-show-user-profile-on-action
Display group member profile (avatar/displayname) in ConfirmUserActionDialogpull/21833/head
commit
74c6ebc5c6
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { MatrixClient } from 'matrix-js-sdk';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
@ -35,6 +36,8 @@ export default React.createClass({
|
||||||
member: React.PropTypes.object,
|
member: React.PropTypes.object,
|
||||||
// group member object. Supply either this or 'member'
|
// group member object. Supply either this or 'member'
|
||||||
groupMember: GroupMemberType,
|
groupMember: GroupMemberType,
|
||||||
|
// needed if a group member is specified
|
||||||
|
matrixClient: React.PropTypes.instanceOf(MatrixClient),
|
||||||
action: React.PropTypes.string.isRequired, // eg. 'Ban'
|
action: React.PropTypes.string.isRequired, // eg. 'Ban'
|
||||||
title: React.PropTypes.string.isRequired, // eg. 'Ban this user?'
|
title: React.PropTypes.string.isRequired, // eg. 'Ban this user?'
|
||||||
|
|
||||||
|
@ -104,10 +107,11 @@ export default React.createClass({
|
||||||
name = this.props.member.name;
|
name = this.props.member.name;
|
||||||
userId = this.props.member.userId;
|
userId = this.props.member.userId;
|
||||||
} else {
|
} else {
|
||||||
// we don't get this info from the API yet
|
const httpAvatarUrl = this.props.groupMember.avatarUrl ?
|
||||||
avatar = <BaseAvatar name={this.props.groupMember.userId} width={48} height={48} />;
|
this.props.matrixClient.mxcUrlToHttp(this.props.groupMember.avatarUrl, 48, 48) : null;
|
||||||
name = this.props.groupMember.userId;
|
name = this.props.groupMember.displayname || this.props.groupMember.userId;
|
||||||
userId = this.props.groupMember.userId;
|
userId = this.props.groupMember.userId;
|
||||||
|
avatar = <BaseAvatar name={name} url={httpAvatarUrl} width={48} height={48} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -83,6 +83,7 @@ module.exports = React.createClass({
|
||||||
_onKick: function() {
|
_onKick: function() {
|
||||||
const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog");
|
const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog");
|
||||||
Modal.createDialog(ConfirmUserActionDialog, {
|
Modal.createDialog(ConfirmUserActionDialog, {
|
||||||
|
matrixClient: this.context.matrixClient,
|
||||||
groupMember: this.props.groupMember,
|
groupMember: this.props.groupMember,
|
||||||
action: this.state.isUserInvited ? _t('Disinvite') : _t('Remove from community'),
|
action: this.state.isUserInvited ? _t('Disinvite') : _t('Remove from community'),
|
||||||
title: this.state.isUserInvited ? _t('Disinvite this user from community?')
|
title: this.state.isUserInvited ? _t('Disinvite this user from community?')
|
||||||
|
|
Loading…
Reference in New Issue