From 668234be4c70b1cdecc9fec6b080222294d5f516 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 30 Oct 2015 17:18:25 +0000 Subject: [PATCH] Add reject button and impl --- src/skins/vector/views/organisms/RoomView.js | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/skins/vector/views/organisms/RoomView.js b/src/skins/vector/views/organisms/RoomView.js index f62eb3c3c..3157712f8 100644 --- a/src/skins/vector/views/organisms/RoomView.js +++ b/src/skins/vector/views/organisms/RoomView.js @@ -63,6 +63,25 @@ module.exports = React.createClass({ this.setState(this.getInitialState()); }, + onRejectButtonClicked: function(ev) { + var self = this; + this.setState({ + rejecting: true + }); + MatrixClientPeg.get().leave(this.props.roomId).done(function() { + dis.dispatch({ action: 'view_next_room' }); + self.setState({ + rejecting: false + }); + }, function(err) { + console.error("Failed to reject invite: %s", err); + self.setState({ + rejecting: false, + rejectError: err + }); + }); + }, + onConferenceNotificationClick: function() { dis.dispatch({ action: 'place_call', @@ -106,7 +125,7 @@ module.exports = React.createClass({ var myUserId = MatrixClientPeg.get().credentials.userId; if (this.state.room.currentState.members[myUserId].membership == 'invite') { - if (this.state.joining) { + if (this.state.joining || this.state.rejecting) { return (
@@ -116,6 +135,7 @@ module.exports = React.createClass({ var inviteEvent = this.state.room.currentState.members[myUserId].events.member.event; // XXX: Leaving this intentionally basic for now because invites are about to change totally var joinErrorText = this.state.joinError ? "Failed to join room!" : ""; + var rejectErrorText = this.state.rejectError ? "Failed to reject invite!" : ""; return (
@@ -123,7 +143,9 @@ module.exports = React.createClass({
{inviteEvent.user_id} has invited you to a room

+
{joinErrorText}
+
{rejectErrorText}
);