mirror of https://github.com/vector-im/riot-web
Fix being wrongly sent to Home space when creating/joining/leaving rooms (#7418)
parent
a20f3560da
commit
f94bad7f0a
|
@ -768,11 +768,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
|
|
||||||
private switchSpaceIfNeeded = throttle(() => {
|
private switchSpaceIfNeeded = throttle(() => {
|
||||||
const roomId = RoomViewStore.getRoomId();
|
const roomId = RoomViewStore.getRoomId();
|
||||||
if (this.isRoomInSpace(this.activeSpace, roomId)) return;
|
if (!this.isRoomInSpace(this.activeSpace, roomId) && !this.matrixClient.getRoom(roomId)?.isSpaceRoom()) {
|
||||||
|
|
||||||
if (this.matrixClient.getRoom(roomId)?.isSpaceRoom()) {
|
|
||||||
this.goToFirstSpace(true);
|
|
||||||
} else {
|
|
||||||
this.switchToRelatedSpace(roomId);
|
this.switchToRelatedSpace(roomId);
|
||||||
}
|
}
|
||||||
}, 100, { leading: true, trailing: true });
|
}, 100, { leading: true, trailing: true });
|
||||||
|
@ -1069,9 +1065,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
|
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case "view_room": {
|
case "view_room": {
|
||||||
// Don't auto-switch rooms when reacting to a context-switch
|
// Don't auto-switch rooms when reacting to a context-switch or for new rooms being created
|
||||||
// as this is not helpful and can create loops of rooms/space switching
|
// as this is not helpful and can create loops of rooms/space switching
|
||||||
if (payload.context_switch) break;
|
if (payload.context_switch || payload.justCreatedOpts) break;
|
||||||
let roomId = payload.room_id;
|
let roomId = payload.room_id;
|
||||||
|
|
||||||
if (payload.room_alias && !roomId) {
|
if (payload.room_alias && !roomId) {
|
||||||
|
|
|
@ -26,6 +26,9 @@ import ErrorDialog from "../components/views/dialogs/ErrorDialog";
|
||||||
import dis from "../dispatcher/dispatcher";
|
import dis from "../dispatcher/dispatcher";
|
||||||
import RoomViewStore from "../stores/RoomViewStore";
|
import RoomViewStore from "../stores/RoomViewStore";
|
||||||
import Spinner from "../components/views/elements/Spinner";
|
import Spinner from "../components/views/elements/Spinner";
|
||||||
|
import { isMetaSpace } from "../stores/spaces";
|
||||||
|
import SpaceStore from "../stores/spaces/SpaceStore";
|
||||||
|
import { Action } from "../dispatcher/actions";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approximation of a membership status for a given room.
|
* Approximation of a membership status for a given room.
|
||||||
|
@ -179,7 +182,16 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RoomViewStore.getRoomId() === roomId) {
|
if (SpaceStore.spacesEnabled &&
|
||||||
|
!isMetaSpace(SpaceStore.instance.activeSpace) &&
|
||||||
|
SpaceStore.instance.activeSpace !== roomId &&
|
||||||
|
RoomViewStore.getRoomId() === roomId
|
||||||
|
) {
|
||||||
|
dis.dispatch({
|
||||||
|
action: Action.ViewRoom,
|
||||||
|
room_id: SpaceStore.instance.activeSpace,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
dis.dispatch({ action: 'view_home_page' });
|
dis.dispatch({ action: 'view_home_page' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue