Don't remove room from store on leave
This commit is contained in:
parent
6146dbeca8
commit
f34721c930
5 changed files with 120 additions and 641 deletions
741
package-lock.json
generated
741
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -30,7 +30,7 @@
|
||||||
"linkify-html": "^4.1.0",
|
"linkify-html": "^4.1.0",
|
||||||
"linkifyjs": "^4.1.0",
|
"linkifyjs": "^4.1.0",
|
||||||
"material-design-icons-iconfont": "^6.1",
|
"material-design-icons-iconfont": "^6.1",
|
||||||
"matrix-js-sdk": "^19.7.0",
|
"matrix-js-sdk": "^23.4.0",
|
||||||
"md-gum-polyfill": "^1.0.0",
|
"md-gum-polyfill": "^1.0.0",
|
||||||
"mic-recorder-to-mp3": "^2.2.2",
|
"mic-recorder-to-mp3": "^2.2.2",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ export default {
|
||||||
return this.fullyReadMarker || this.room.getEventReadUpTo(this.$matrix.currentUserId, false);
|
return this.fullyReadMarker || this.room.getEventReadUpTo(this.$matrix.currentUserId, false);
|
||||||
},
|
},
|
||||||
fullyReadMarker() {
|
fullyReadMarker() {
|
||||||
const readEvent = this.room.getAccountData("m.fully_read");
|
const readEvent = this.room && this.room.getAccountData("m.fully_read");
|
||||||
if (readEvent) {
|
if (readEvent) {
|
||||||
return readEvent.getContent().event_id;
|
return readEvent.getContent().event_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,10 @@ export default {
|
||||||
if (roomName && roomName.startsWith("@")) {
|
if (roomName && roomName.startsWith("@")) {
|
||||||
return roomName.substring(roomName.indexOf("@") + 1, lastIndex);
|
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() {
|
getRoomInfo() {
|
||||||
if (this.roomId.startsWith("#")) {
|
if (this.roomId.startsWith("#")) {
|
||||||
|
|
@ -306,6 +309,8 @@ export default {
|
||||||
const room = this.$matrix.getRoom(this.roomId);
|
const room = this.$matrix.getRoom(this.roomId);
|
||||||
if (room) {
|
if (room) {
|
||||||
this.roomName = this.removeHomeServer(room.name || this.roomName);
|
this.roomName = this.removeHomeServer(room.name || this.roomName);
|
||||||
|
} else {
|
||||||
|
this.roomName = this.removeHomeServer(this.roomAliasOrId);
|
||||||
}
|
}
|
||||||
this.waitingForInfo = false;
|
this.waitingForInfo = false;
|
||||||
}
|
}
|
||||||
|
|
@ -385,14 +390,14 @@ export default {
|
||||||
return this.$matrix.matrixClient.joinRoom(this.roomId);
|
return this.$matrix.matrixClient.joinRoom(this.roomId);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((ignoredRoom) => {
|
.then((room) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.loadingMessage = null;
|
this.loadingMessage = null;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$navigation.push(
|
this.$navigation.push(
|
||||||
{
|
{
|
||||||
name: "Chat",
|
name: "Chat",
|
||||||
params: { roomId: util.sanitizeRoomId(this.roomAliasOrId) },
|
params: { roomId: util.sanitizeRoomId(room.roomId) },
|
||||||
},
|
},
|
||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export default {
|
||||||
return new LocalStorageCryptoStore(this.$store.getters.storage);
|
return new LocalStorageCryptoStore(this.$store.getters.storage);
|
||||||
},
|
},
|
||||||
login(user) {
|
login(user) {
|
||||||
const tempMatrixClient = sdk.createClient(user.home_server);
|
const tempMatrixClient = sdk.createClient({baseUrl: user.home_server});
|
||||||
var promiseLogin;
|
var promiseLogin;
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
@ -492,10 +492,11 @@ export default {
|
||||||
|
|
||||||
leaveRoom(roomId) {
|
leaveRoom(roomId) {
|
||||||
return this.matrixClient.leave(roomId, undefined).then(() => {
|
return this.matrixClient.leave(roomId, undefined).then(() => {
|
||||||
|
this.$store.commit("setCurrentRoomId", null);
|
||||||
this.rooms = this.rooms.filter((room) => {
|
this.rooms = this.rooms.filter((room) => {
|
||||||
room.roomId != roomId;
|
room.roomId != roomId;
|
||||||
});
|
});
|
||||||
this.matrixClient.store.removeRoom(roomId);
|
//this.matrixClient.store.removeRoom(roomId);
|
||||||
//this.matrixClient.forget(roomId, true, undefined);
|
//this.matrixClient.forget(roomId, true, undefined);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue