Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8af6bc0

Browse files
authored
Merge pull request #2955 from matrix-org/t3chguy/close_room_settings_leave_room
Close Room Settings upon Leave Room
2 parents 76f37d6 + 249f3d9 commit 8af6bc0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/components/views/dialogs/RoomSettingsDialog.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
Copyright 2019 New Vector Ltd
3+
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
34
45
Licensed under the Apache License, Version 2.0 (the "License");
56
you may not use this file except in compliance with the License.
@@ -24,13 +25,30 @@ import GeneralRoomSettingsTab from "../settings/tabs/room/GeneralRoomSettingsTab
2425
import SecurityRoomSettingsTab from "../settings/tabs/room/SecurityRoomSettingsTab";
2526
import sdk from "../../../index";
2627
import MatrixClientPeg from "../../../MatrixClientPeg";
28+
import dis from "../../../dispatcher";
2729

2830
export default class RoomSettingsDialog extends React.Component {
2931
static propTypes = {
3032
roomId: PropTypes.string.isRequired,
3133
onFinished: PropTypes.func.isRequired,
3234
};
3335

36+
componentWillMount() {
37+
this._dispatcherRef = dis.register(this._onAction);
38+
}
39+
40+
componentWillUnmount() {
41+
dis.unregister(this._dispatcherRef);
42+
}
43+
44+
_onAction = (payload) => {
45+
// When room changes below us, close the room settings
46+
// whilst the modal is open this can only be triggered when someone hits Leave Room
47+
if (payload.action === 'view_next_room') {
48+
this.props.onFinished();
49+
}
50+
};
51+
3452
_getTabs() {
3553
const tabs = [];
3654

0 commit comments

Comments
 (0)