fix(logout): clear the call-volume list and settings-sync stamp (#347) #357
@@ -83,3 +83,14 @@ test('clearPlaintextCaches wipes drafts (#41) and the status message (#204) but
|
||||
assert.ok(!removed.includes('cinny_session'), 'session key not this module’s concern');
|
||||
assert.ok(store.has('cinny_session'));
|
||||
});
|
||||
|
||||
test('clearPlaintextCaches removes the call-volume list and the settings-sync stamp (#347)', () => {
|
||||
store.clear();
|
||||
store.set('lotus-per-user-volume', '{"@bob:server":0.3}');
|
||||
store.set('settings-sync-meta:@me:server', '{"lastSyncedAt":1}');
|
||||
store.set('settings', '{}');
|
||||
clearPlaintextCaches('@me:server');
|
||||
assert.equal(store.has('lotus-per-user-volume'), false);
|
||||
assert.equal(store.has('settings-sync-meta:@me:server'), false);
|
||||
assert.equal(store.has('settings'), true, 'device preferences are kept');
|
||||
});
|
||||
|
||||
@@ -47,6 +47,8 @@ const clearMsgDrafts = (): void => {
|
||||
* - `cinny_recent_gifs_v1` / `cinny_recent_stickers_v1` — media the user sent
|
||||
* - `navToActivePath<userId>` — per-space last-visited room paths (needs userId)
|
||||
* - `lotus_outbox_v1` — decrypted content of messages not yet sent ([Gitea #112])
|
||||
* - `lotus-per-user-volume`, `settings-sync-meta:<userId>` — whom you adjusted in
|
||||
* calls, and a key naming the account ([Gitea #347])
|
||||
* - `draft-msg-*` — unsent composer drafts (decrypted message text, unscoped by
|
||||
* user — see [Gitea #41]; previously deliberately preserved across logout
|
||||
* (N98), which let the next account on this device see/send a prior user's
|
||||
@@ -92,6 +94,24 @@ const clearStatusMessage = (): void => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* [Gitea #347] Per-person residue that isn't message text but still says whom
|
||||
* the previous user dealt with: Element Call's per-user volume memory (same
|
||||
* origin on the web — element-call `lotusVolumeMemory.ts`) and the settings-sync
|
||||
* stamp, whose key names the account.
|
||||
*/
|
||||
export const CALL_VOLUME_KEY = 'lotus-per-user-volume';
|
||||
const clearCallVolumesAndSyncMeta = (userId?: string): void => {
|
||||
const keys = [CALL_VOLUME_KEY, ...(userId ? [`settings-sync-meta:${userId}`] : [])];
|
||||
keys.forEach((key) => {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
} catch {
|
||||
// best-effort
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const clearPlaintextCaches = (userId?: string): void => {
|
||||
clearTranslationCache();
|
||||
clearScheduledMessages();
|
||||
@@ -103,5 +123,6 @@ export const clearPlaintextCaches = (userId?: string): void => {
|
||||
clearOutbox();
|
||||
clearCallSession();
|
||||
clearStatusMessage();
|
||||
clearCallVolumesAndSyncMeta(userId);
|
||||
if (userId) clearNavToActivePathStore(userId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user