Ensure we obliterate 3pid invites on logout
parent
803badba1b
commit
525ec6b709
|
|
@ -667,13 +667,13 @@ export async function onLoggedOut() {
|
||||||
// that can occur when components try to use a null client.
|
// that can occur when components try to use a null client.
|
||||||
dis.dispatch({action: 'on_logged_out'}, true);
|
dis.dispatch({action: 'on_logged_out'}, true);
|
||||||
stopMatrixClient();
|
stopMatrixClient();
|
||||||
await _clearStorage();
|
await _clearStorage({deleteEverything: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise} promise which resolves once the stores have been cleared
|
* @returns {Promise} promise which resolves once the stores have been cleared
|
||||||
*/
|
*/
|
||||||
async function _clearStorage() {
|
async function _clearStorage(opts: {deleteEverything: boolean}) {
|
||||||
Analytics.disable();
|
Analytics.disable();
|
||||||
|
|
||||||
if (window.localStorage) {
|
if (window.localStorage) {
|
||||||
|
|
@ -683,11 +683,13 @@ async function _clearStorage() {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
|
|
||||||
// now restore those invites
|
// now restore those invites
|
||||||
pendingInvites.forEach(i => {
|
if (!opts?.deleteEverything) {
|
||||||
const roomId = i.roomId;
|
pendingInvites.forEach(i => {
|
||||||
delete i.roomId; // delete to avoid confusing the store
|
const roomId = i.roomId;
|
||||||
ThreepidInviteStore.instance.storeInvite(roomId, i);
|
delete i.roomId; // delete to avoid confusing the store
|
||||||
});
|
ThreepidInviteStore.instance.storeInvite(roomId, i);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.sessionStorage) {
|
if (window.sessionStorage) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue