Don't save if isSpaceRoom()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-03-26 08:13:50 +01:00
parent c26da1bce6
commit efb8c89433
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 12 additions and 7 deletions

View File

@ -490,15 +490,20 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
if (!SettingsStore.getValue("feature_spaces")) return;
switch (payload.action) {
case "view_room": {
// persist last viewed room from a space
const activeSpaceId = this.activeSpace?.roomId || LAST_VIEWED_ROOMS_HOME;
const lastViewedRooms = JSON.parse(window.localStorage.getItem(LAST_VIEWED_ROOMS)) || {};
lastViewedRooms[activeSpaceId] = payload.room_id;
window.localStorage.setItem(LAST_VIEWED_ROOMS, JSON.stringify(lastViewedRooms));
const room = this.matrixClient?.getRoom(payload.room_id);
// persist last viewed room from a space
// We don't want to save if the room is a
// space room since it can cause problems
if (!room.isSpaceRoom()) {
const activeSpaceId = this.activeSpace?.roomId || LAST_VIEWED_ROOMS_HOME;
const lastViewedRooms = JSON.parse(window.localStorage.getItem(LAST_VIEWED_ROOMS)) || {};
lastViewedRooms[activeSpaceId] = payload.room_id;
window.localStorage.setItem(LAST_VIEWED_ROOMS, JSON.stringify(lastViewedRooms));
}
if (room?.getMyMembership() === "join") {
if (room.isSpaceRoom()) {
this.setActiveSpace(room);