From 6bfc566d9acc7934ce30856eff73a3e0c3bab998 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 22 Jul 2015 11:41:32 +0100 Subject: [PATCH] Switch to another room when we succesfully leave a room --- skins/base/views/molecules/MemberTile.js | 14 -------------- src/controllers/molecules/MemberTile.js | 15 +++++++++++++++ src/controllers/organisms/RoomList.js | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/skins/base/views/molecules/MemberTile.js b/skins/base/views/molecules/MemberTile.js index 3e5887446d..574be2254e 100644 --- a/skins/base/views/molecules/MemberTile.js +++ b/skins/base/views/molecules/MemberTile.js @@ -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; diff --git a/src/controllers/molecules/MemberTile.js b/src/controllers/molecules/MemberTile.js index 811d2a78b1..20ace568a8 100644 --- a/src/controllers/molecules/MemberTile.js +++ b/src/controllers/molecules/MemberTile.js @@ -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() + }); + }); + } }; diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js index 950f2e10b4..054e5f4e1e 100644 --- a/src/controllers/organisms/RoomList.js +++ b/src/controllers/organisms/RoomList.js @@ -122,4 +122,3 @@ module.exports = { }); }, }; -