Switch to another room when we succesfully leave a room

pull/1/head
Erik Johnston 2015-07-22 11:41:32 +01:00
parent 5835ea0a97
commit 6bfc566d9a
3 changed files with 15 additions and 15 deletions

View File

@ -42,20 +42,6 @@ module.exports = React.createClass({
this.setState({ 'hover': false });
},
onLeaveClick: function() {
var d = MatrixClientPeg.get().leave(this.props.member.roomId);
// TODO: Add spinner
d.then(function() {
// TODO: Change to another room.
}, function(err) {
Modal.createDialog(ErrorDialog, {
title: "Failed to leave room",
description: err.toString()
});
});
},
render: function() {
var isMyUser = MatrixClientPeg.get().credentials.userId == this.props.member.userId;

View File

@ -27,4 +27,19 @@ module.exports = {
user_id: this.props.member.userId
});
},
onLeaveClick: function() {
var d = MatrixClientPeg.get().leave(this.props.member.roomId);
// TODO: Add spinner
d.then(function() {
// TODO: Change to another room.
dis.dispatch({action: 'view_next_room'});
}, function(err) {
Modal.createDialog(ErrorDialog, {
title: "Failed to leave room",
description: err.toString()
});
});
}
};

View File

@ -122,4 +122,3 @@ module.exports = {
});
},
};