parent
3b3e21b8da
commit
929b81d4b4
2 changed files with 22 additions and 1 deletions
|
|
@ -188,7 +188,7 @@ class Util {
|
||||||
Promise.all(setAsKnownPromises)
|
Promise.all(setAsKnownPromises)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// All devices now marked as "known", try to resend
|
// All devices now marked as "known", try to resend
|
||||||
matrixClient.resendEvent(err.event)
|
matrixClient.resendEvent(err.event, matrixClient.getRoom(err.event.getRoomId()))
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
console.log("Message sent: ", result);
|
console.log("Message sent: ", result);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
|
|
||||||
|
|
@ -114,13 +114,34 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearCryptoStore() {
|
||||||
|
// Clear crypto related data
|
||||||
|
// TODO - for some reason "clearStores" called in "logout" only clears the "account" crypto
|
||||||
|
// data item, not all sessions etc. Why? We need to do that manually here!
|
||||||
|
const toRemove = [];
|
||||||
|
for (let i = 0; i < localStorage.length; ++i) {
|
||||||
|
const key = localStorage.key(i);
|
||||||
|
if (key.startsWith("crypto.")) toRemove.push(key);
|
||||||
|
}
|
||||||
|
for (const key of toRemove) {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
if (this.matrixClient) {
|
if (this.matrixClient) {
|
||||||
this.removeMatrixClientListeners(this.matrixClient);
|
this.removeMatrixClientListeners(this.matrixClient);
|
||||||
this.matrixClient.stopClient();
|
this.matrixClient.stopClient();
|
||||||
|
this.matrixClient.clearStores().then(() => {
|
||||||
|
this.clearCryptoStore()
|
||||||
|
})
|
||||||
this.matrixClient = null;
|
this.matrixClient = null;
|
||||||
this.matrixClientReady = false;
|
this.matrixClientReady = false;
|
||||||
|
} else {
|
||||||
|
this.clearCryptoStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
localStorage.removeItem('user');
|
localStorage.removeItem('user');
|
||||||
this.$store.commit("setCurrentRoomId", null);
|
this.$store.commit("setCurrentRoomId", null);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue