mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-10 00:50:11 +01:00
Allow users to delete their chats when deleting characters
This commit is contained in:
parent
d401aa1a6f
commit
7972307b69
@ -1,15 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
import {
|
||||
callPopup,
|
||||
characters, deleteCharacter,
|
||||
event_types,
|
||||
eventSource,
|
||||
getCharacters,
|
||||
getOneCharacter,
|
||||
getRequestHeaders, handleDeleteCharacter, this_chid
|
||||
} from "../script.js";
|
||||
import {favsToHotswap} from "./RossAscends-mods.js";
|
||||
|
||||
const popupMessage = {
|
||||
deleteChat(characterCount) {
|
||||
return `<h3>Delete ${characterCount} characters?</h3>
|
||||
<b>THIS IS PERMANENT!<br><br>
|
||||
<label for="del_char_checkbox" class="checkbox_label justifyCenter">
|
||||
<input type="checkbox" id="del_char_checkbox" />
|
||||
<span>Also delete the chat files</span>
|
||||
</label><br></b>`;
|
||||
}
|
||||
}
|
||||
|
||||
const toggleFavoriteHighlight = (characterId) => {
|
||||
const element = document.getElementById(`CharID${characterId}`);
|
||||
element.classList.toggle('is_fav');
|
||||
@ -317,9 +328,16 @@ class CharacterGroupOverlay {
|
||||
.then(() => getCharacters())
|
||||
.then(() => this.browseState())
|
||||
|
||||
handleContextMenuDelete = () => Promise.all(this.selectedCharacters.map(async characterId => CharacterContextMenu.delete(characterId)))
|
||||
.then(() => getCharacters())
|
||||
.then(() => this.browseState())
|
||||
handleContextMenuDelete = () => {
|
||||
callPopup(
|
||||
popupMessage.deleteChat(this.selectedCharacters.length),
|
||||
null
|
||||
).then(deleteChats =>
|
||||
Promise.all(this.selectedCharacters.map(async characterId => CharacterContextMenu.delete(characterId, deleteChats)))
|
||||
.then(() => getCharacters())
|
||||
.then(() => this.browseState())
|
||||
);
|
||||
}
|
||||
|
||||
addStateChangeCallback = callback => this.stateChangeCallbacks.push(callback);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user