From 5004a3a5b30652a5c6ae8d9e79819b496c3f57ad Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 1 Oct 2015 09:42:58 +0100 Subject: [PATCH] Make end call button work for conf calls --- src/CallHandler.js | 13 ++++++++++--- src/controllers/molecules/RoomHeader.js | 8 ++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/CallHandler.js b/src/CallHandler.js index b2996153d8..d0cf16f801 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -264,9 +264,16 @@ if (!global.mxCallHandler) { var callHandler = { getCallForRoom: function(roomId) { - return ( - module.exports.getCall(roomId) - ); + var call = module.exports.getCall(roomId); + if (call) return call; + + if (Modulator.hasConferenceHandler()) { + var ConferenceHandler = Modulator.getConferenceHandler(); + call = ConferenceHandler.getConferenceCallForRoom(roomId); + } + if (call) return call; + + return null; }, getCall: function(roomId) { diff --git a/src/controllers/molecules/RoomHeader.js b/src/controllers/molecules/RoomHeader.js index 2ef99953d0..5c4db3a92e 100644 --- a/src/controllers/molecules/RoomHeader.js +++ b/src/controllers/molecules/RoomHeader.js @@ -44,7 +44,7 @@ module.exports = { componentDidMount: function() { this.dispatcherRef = dis.register(this.onAction); if (this.props.room) { - var call = CallHandler.getCall(this.props.room.roomId); + var call = CallHandler.getCallForRoom(this.props.room.roomId); var callState = call ? call.call_state : "ended"; this.setState({ call_state: callState @@ -87,9 +87,13 @@ module.exports = { }); }, onHangupClick: function() { + var call = CallHandler.getCallForRoom(this.props.room.roomId); + if (!call) { return; } dis.dispatch({ action: 'hangup', - room_id: this.props.room.roomId + // hangup the call for this room, which may not be the room in props + // (e.g. conferences which will hangup the 1:1 room instead) + room_id: call.roomId }); } };