@@ -63,6 +63,25 @@ module.exports = React.createClass({
6363 this . setState ( this . getInitialState ( ) ) ;
6464 } ,
6565
66+ onRejectButtonClicked : function ( ev ) {
67+ var self = this ;
68+ this . setState ( {
69+ rejecting : true
70+ } ) ;
71+ MatrixClientPeg . get ( ) . leave ( this . props . roomId ) . done ( function ( ) {
72+ dis . dispatch ( { action : 'view_next_room' } ) ;
73+ self . setState ( {
74+ rejecting : false
75+ } ) ;
76+ } , function ( err ) {
77+ console . error ( "Failed to reject invite: %s" , err ) ;
78+ self . setState ( {
79+ rejecting : false ,
80+ rejectError : err
81+ } ) ;
82+ } ) ;
83+ } ,
84+
6685 onConferenceNotificationClick : function ( ) {
6786 dis . dispatch ( {
6887 action : 'place_call' ,
@@ -106,7 +125,7 @@ module.exports = React.createClass({
106125
107126 var myUserId = MatrixClientPeg . get ( ) . credentials . userId ;
108127 if ( this . state . room . currentState . members [ myUserId ] . membership == 'invite' ) {
109- if ( this . state . joining ) {
128+ if ( this . state . joining || this . state . rejecting ) {
110129 return (
111130 < div className = "mx_RoomView" >
112131 < Loader />
@@ -116,14 +135,17 @@ module.exports = React.createClass({
116135 var inviteEvent = this . state . room . currentState . members [ myUserId ] . events . member . event ;
117136 // XXX: Leaving this intentionally basic for now because invites are about to change totally
118137 var joinErrorText = this . state . joinError ? "Failed to join room!" : "" ;
138+ var rejectErrorText = this . state . rejectError ? "Failed to reject invite!" : "" ;
119139 return (
120140 < div className = "mx_RoomView" >
121141 < RoomHeader ref = "header" room = { this . state . room } simpleHeader = "Room invite" />
122142 < div className = "mx_RoomView_invitePrompt" >
123143 < div > { inviteEvent . user_id } has invited you to a room</ div >
124144 < br />
125145 < button ref = "joinButton" onClick = { this . onJoinButtonClicked } > Join</ button >
146+ < button onClick = { this . onRejectButtonClicked } > Reject</ button >
126147 < div className = "error" > { joinErrorText } </ div >
148+ < div className = "error" > { rejectErrorText } </ div >
127149 </ div >
128150 </ div >
129151 ) ;
0 commit comments