Implement button to remove a room from a group

NB: This doesn't provide any feedback to the user. We should use a GroupSummaryStore-style component to refresh the view after a successful hit to the API. This could affect the summary view as well, because when rooms are removed from a group, they are also removed from the summary (if necessary).
This commit is contained in:
Luke Barnard 2017-09-29 17:59:24 +01:00
parent 0a53630806
commit 955ca6cd2b
2 changed files with 12 additions and 2 deletions

View file

@ -49,6 +49,13 @@ const GroupRoomTile = React.createClass({
});
},
onDeleteClick: function(e) {
e.preventDefault();
e.stopPropagation();
this.context.matrixClient
.removeRoomFromGroup(this.props.groupId, this.props.groupRoom.roomId);
},
render: function() {
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
@ -76,6 +83,9 @@ const GroupRoomTile = React.createClass({
<div className="mx_GroupRoomTile_name">
{ name }
</div>
<AccessibleButton className="mx_GroupRoomTile_delete" onClick={this.onDeleteClick}>
<img src="img/cancel-small.svg" />
</AccessibleButton>
</AccessibleButton>
);
},