From 249f3d972b2230fececd82e2525f293561a25ba9 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 10 May 2019 20:58:32 +0100 Subject: [PATCH] Close Room Settings upon Leave Room Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/dialogs/RoomSettingsDialog.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/components/views/dialogs/RoomSettingsDialog.js b/src/components/views/dialogs/RoomSettingsDialog.js index 05ed262078..c221289ff3 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.js +++ b/src/components/views/dialogs/RoomSettingsDialog.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,6 +25,7 @@ import GeneralRoomSettingsTab from "../settings/tabs/room/GeneralRoomSettingsTab import SecurityRoomSettingsTab from "../settings/tabs/room/SecurityRoomSettingsTab"; import sdk from "../../../index"; import MatrixClientPeg from "../../../MatrixClientPeg"; +import dis from "../../../dispatcher"; export default class RoomSettingsDialog extends React.Component { static propTypes = { @@ -31,6 +33,22 @@ export default class RoomSettingsDialog extends React.Component { onFinished: PropTypes.func.isRequired, }; + componentWillMount() { + this._dispatcherRef = dis.register(this._onAction); + } + + componentWillUnmount() { + dis.unregister(this._dispatcherRef); + } + + _onAction = (payload) => { + // When room changes below us, close the room settings + // whilst the modal is open this can only be triggered when someone hits Leave Room + if (payload.action === 'view_next_room') { + this.props.onFinished(); + } + }; + _getTabs() { const tabs = [];