Clear media alerts from storage on character deletion

ee101353d8832bf6f97031f00ccff87b41a623f6

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +10 -0Ignore whitespace
public/script.js+6 -0
@@ -9451,6 +9451,9 @@ export async function deleteCharacter(characterKey, { deleteChats = true } = {})
9451 continue;9451 continue;
9452 }9452 }
94539453
9454 accountStorage.removeItem(`AlertWI_${character.avatar}`);
9455 accountStorage.removeItem(`AlertRegex_${character.avatar}`);
9456 accountStorage.removeItem(`mediaWarningShown:${character.avatar}`);
9454 delete tag_map[character.avatar];9457 delete tag_map[character.avatar];
9455 select_rm_info('char_delete', character.name);9458 select_rm_info('char_delete', character.name);
94569459
@@ -11658,6 +11661,9 @@ jQuery(async function () {
11658 eventSource.on(event_types.GROUP_CHAT_DELETED, async (name) => {11661 eventSource.on(event_types.GROUP_CHAT_DELETED, async (name) => {
11659 await deleteItemizedPrompts(name);11662 await deleteItemizedPrompts(name);
11660 });11663 });
11664 eventSource.on(event_types.CHARACTER_DELETED, async() => {
11665
11666 });
1166111667
11662 initCustomSelectedSamplers();11668 initCustomSelectedSamplers();
11663});11669});
public/scripts/util/AccountStorage.js+4 -0
@@ -105,6 +105,10 @@ class AccountStorage {
105 console.warn(`AccountStorage not ready (trying to remove ${key})`);105 console.warn(`AccountStorage not ready (trying to remove ${key})`);
106 }106 }
107107
108 if (!Object.hasOwn(this.state, key)) {
109 return;
110 }
111
108 delete this.state[key];112 delete this.state[key];
109 saveSettingsDebounced();113 saveSettingsDebounced();
110 }114 }