Don't remove room from store on leave

This commit is contained in:
N Pex 2023-03-16 08:17:29 +00:00 committed by n8fr8
parent 6146dbeca8
commit f34721c930
5 changed files with 120 additions and 641 deletions

741
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,7 @@
"linkify-html": "^4.1.0",
"linkifyjs": "^4.1.0",
"material-design-icons-iconfont": "^6.1",
"matrix-js-sdk": "^19.7.0",
"matrix-js-sdk": "^23.4.0",
"md-gum-polyfill": "^1.0.0",
"mic-recorder-to-mp3": "^2.2.2",
"path-browserify": "^1.0.1",

View file

@ -458,7 +458,7 @@ export default {
return this.fullyReadMarker || this.room.getEventReadUpTo(this.$matrix.currentUserId, false);
},
fullyReadMarker() {
const readEvent = this.room.getAccountData("m.fully_read");
const readEvent = this.room && this.room.getAccountData("m.fully_read");
if (readEvent) {
return readEvent.getContent().event_id;
}

View file

@ -269,7 +269,10 @@ export default {
if (roomName && roomName.startsWith("@")) {
return roomName.substring(roomName.indexOf("@") + 1, lastIndex);
}
return roomName ? roomName.substring(roomName.indexOf("#") + 1, lastIndex) : "";
if (roomName && roomName.startsWith("#")) {
return roomName.substring(roomName.indexOf("#") + 1, lastIndex);
}
return roomName ? roomName : "";
},
getRoomInfo() {
if (this.roomId.startsWith("#")) {
@ -306,6 +309,8 @@ export default {
const room = this.$matrix.getRoom(this.roomId);
if (room) {
this.roomName = this.removeHomeServer(room.name || this.roomName);
} else {
this.roomName = this.removeHomeServer(this.roomAliasOrId);
}
this.waitingForInfo = false;
}
@ -385,14 +390,14 @@ export default {
return this.$matrix.matrixClient.joinRoom(this.roomId);
}
})
.then((ignoredRoom) => {
.then((room) => {
this.loading = false;
this.loadingMessage = null;
this.$nextTick(() => {
this.$navigation.push(
{
name: "Chat",
params: { roomId: util.sanitizeRoomId(this.roomAliasOrId) },
params: { roomId: util.sanitizeRoomId(room.roomId) },
},
-1
);

View file

@ -103,7 +103,7 @@ export default {
return new LocalStorageCryptoStore(this.$store.getters.storage);
},
login(user) {
const tempMatrixClient = sdk.createClient(user.home_server);
const tempMatrixClient = sdk.createClient({baseUrl: user.home_server});
var promiseLogin;
const self = this;
@ -492,10 +492,11 @@ export default {
leaveRoom(roomId) {
return this.matrixClient.leave(roomId, undefined).then(() => {
this.$store.commit("setCurrentRoomId", null);
this.rooms = this.rooms.filter((room) => {
room.roomId != roomId;
});
this.matrixClient.store.removeRoom(roomId);
//this.matrixClient.store.removeRoom(roomId);
//this.matrixClient.forget(roomId, true, undefined);
});
},