mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #298 from vector-im/kegan/reject-invites
Add invite rejection
This commit is contained in:
commit
3b82884947
@ -63,6 +63,25 @@ module.exports = React.createClass({
|
|||||||
this.setState(this.getInitialState());
|
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
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onSearchClick: function() {
|
onSearchClick: function() {
|
||||||
this.setState({ searching: true });
|
this.setState({ searching: true });
|
||||||
},
|
},
|
||||||
@ -111,7 +130,7 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
var myUserId = MatrixClientPeg.get().credentials.userId;
|
var myUserId = MatrixClientPeg.get().credentials.userId;
|
||||||
if (this.state.room.currentState.members[myUserId].membership == 'invite') {
|
if (this.state.room.currentState.members[myUserId].membership == 'invite') {
|
||||||
if (this.state.joining) {
|
if (this.state.joining || this.state.rejecting) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<Loader />
|
<Loader />
|
||||||
@ -121,6 +140,7 @@ module.exports = React.createClass({
|
|||||||
var inviteEvent = this.state.room.currentState.members[myUserId].events.member.event;
|
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
|
// XXX: Leaving this intentionally basic for now because invites are about to change totally
|
||||||
var joinErrorText = this.state.joinError ? "Failed to join room!" : "";
|
var joinErrorText = this.state.joinError ? "Failed to join room!" : "";
|
||||||
|
var rejectErrorText = this.state.rejectError ? "Failed to reject invite!" : "";
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomHeader ref="header" room={this.state.room} simpleHeader="Room invite"/>
|
<RoomHeader ref="header" room={this.state.room} simpleHeader="Room invite"/>
|
||||||
@ -128,7 +148,9 @@ module.exports = React.createClass({
|
|||||||
<div>{inviteEvent.user_id} has invited you to a room</div>
|
<div>{inviteEvent.user_id} has invited you to a room</div>
|
||||||
<br/>
|
<br/>
|
||||||
<button ref="joinButton" onClick={this.onJoinButtonClicked}>Join</button>
|
<button ref="joinButton" onClick={this.onJoinButtonClicked}>Join</button>
|
||||||
|
<button onClick={this.onRejectButtonClicked}>Reject</button>
|
||||||
<div className="error">{joinErrorText}</div>
|
<div className="error">{joinErrorText}</div>
|
||||||
|
<div className="error">{rejectErrorText}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user