From 4e234cfc3b28cbf986da4714a57d7d013b6a6f6f Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 30 Oct 2017 18:17:35 +0000 Subject: [PATCH] Alter UI for disinviting a group member The same API as kicking is used for disinviting, so only cosmetic changes needed here. --- src/components/views/groups/GroupMemberInfo.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/views/groups/GroupMemberInfo.js b/src/components/views/groups/GroupMemberInfo.js index 5bae4d65d2..4c0b54e891 100644 --- a/src/components/views/groups/GroupMemberInfo.js +++ b/src/components/views/groups/GroupMemberInfo.js @@ -37,6 +37,7 @@ module.exports = React.createClass({ propTypes: { groupId: PropTypes.string, groupMember: GroupMemberType, + isInvited: PropTypes.bool, }, getInitialState: function() { @@ -72,6 +73,9 @@ module.exports = React.createClass({ onGroupStoreUpdated: function() { this.setState({ + isUserInvited: this._groupStore.getGroupInvitedMembers().some( + (m) => m.userId === this.props.groupMember.userId, + ), isUserPrivilegedInGroup: this._groupStore.isUserPrivileged(), }); }, @@ -80,7 +84,7 @@ module.exports = React.createClass({ const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog"); Modal.createDialog(ConfirmUserActionDialog, { groupMember: this.props.groupMember, - action: _t('Remove from community'), + action: this.state.isUserInvited ? _t('Disinvite') : _t('Remove from community'), danger: true, onFinished: (proceed) => { if (!proceed) return; @@ -98,7 +102,9 @@ module.exports = React.createClass({ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createTrackedDialog('Failed to remove user from group', '', ErrorDialog, { title: _t('Error'), - description: _t('Failed to remove user from community'), + description: this.state.isUserInvited ? + _t('Failed to withdraw invitation') : + _t('Failed to remove user from community'), }); }).finally(() => { this.setState({removingUser: false}); @@ -133,7 +139,7 @@ module.exports = React.createClass({ const kickButton = ( - { _t('Remove from community') } + { this.state.isUserInvited ? _t('Disinvite') : _t('Remove from community') } );