Don't switch rooms when forgetting a room (#3275)

Don't randomly change to another room upon forgetting a room.
This commit is contained in:
Andrew Morgan 2019-08-05 10:34:46 +01:00 committed by GitHub
parent 98c0232a96
commit f80cbebb9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ import * as Rooms from '../../../Rooms';
import * as RoomNotifs from '../../../RoomNotifs'; import * as RoomNotifs from '../../../RoomNotifs';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import RoomListActions from '../../../actions/RoomListActions'; import RoomListActions from '../../../actions/RoomListActions';
import RoomViewStore from '../../../stores/RoomViewStore';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'RoomTileContextMenu', displayName: 'RoomTileContextMenu',
@ -158,8 +159,12 @@ module.exports = React.createClass({
_onClickForget: function() { _onClickForget: function() {
// FIXME: duplicated with RoomSettings (and dead code in RoomView) // FIXME: duplicated with RoomSettings (and dead code in RoomView)
MatrixClientPeg.get().forget(this.props.room.roomId).done(function() { MatrixClientPeg.get().forget(this.props.room.roomId).done(() => {
dis.dispatch({ action: 'view_next_room' }); // Switch to another room view if we're currently viewing the
// historical room
if (RoomViewStore.getRoomId() === this.props.room.roomId) {
dis.dispatch({ action: 'view_next_room' });
}
}, function(err) { }, function(err) {
const errCode = err.errcode || _td("unknown error code"); const errCode = err.errcode || _td("unknown error code");
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");