mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix duplication of the last character on deletion. Delete tags from tag_map on deletion of character/groups
This commit is contained in:
@@ -5486,16 +5486,17 @@ $(document).ready(function () {
|
|||||||
" -- Name: " +
|
" -- Name: " +
|
||||||
characters[this_chid].name
|
characters[this_chid].name
|
||||||
);
|
);
|
||||||
|
const avatar = characters[this_chid].avatar;
|
||||||
|
const name = characters[this_chid].name;
|
||||||
var msg = jQuery("#form_create").serialize(); // ID form
|
var msg = jQuery("#form_create").serialize(); // ID form
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/deletecharacter",
|
url: "/deletecharacter",
|
||||||
beforeSend: function () {
|
beforeSend: function () {
|
||||||
select_rm_info("char_delete", characters[this_chid].name);
|
|
||||||
},
|
},
|
||||||
data: msg,
|
data: msg,
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function (html) {
|
success: async function (html) {
|
||||||
//RossAscends: New handling of character deletion that avoids page refreshes and should have
|
//RossAscends: New handling of character deletion that avoids page refreshes and should have
|
||||||
// fixed char corruption due to cache problems.
|
// fixed char corruption due to cache problems.
|
||||||
//due to how it is handled with 'popup_type', i couldn't find a way to make my method completely
|
//due to how it is handled with 'popup_type', i couldn't find a way to make my method completely
|
||||||
@@ -5516,7 +5517,9 @@ $(document).ready(function () {
|
|||||||
.text(""); // removes character name from nav tabs
|
.text(""); // removes character name from nav tabs
|
||||||
clearChat(); // removes deleted char's chat
|
clearChat(); // removes deleted char's chat
|
||||||
this_chid = undefined; // prevents getCharacters from trying to load an invalid char.
|
this_chid = undefined; // prevents getCharacters from trying to load an invalid char.
|
||||||
getCharacters(); // gets the new list of characters (that doesn't include the deleted one)
|
delete tag_map[avatar]; // removes deleted char's avatar from tag_map
|
||||||
|
await getCharacters(); // gets the new list of characters (that doesn't include the deleted one)
|
||||||
|
select_rm_info("char_delete", name); // also updates the 'deleted character' message
|
||||||
printMessages(); // prints out system user's 'deleted character' message
|
printMessages(); // prints out system user's 'deleted character' message
|
||||||
//console.log("#dialogue_popup_ok(del-char) >>>> saving");
|
//console.log("#dialogue_popup_ok(del-char) >>>> saving");
|
||||||
saveSettingsDebounced(); // saving settings to keep changes to variables
|
saveSettingsDebounced(); // saving settings to keep changes to variables
|
||||||
|
@@ -57,7 +57,7 @@ import {
|
|||||||
event_types,
|
event_types,
|
||||||
getCurrentChatId,
|
getCurrentChatId,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { appendTagToList, createTagMapFromList, getTagsList, applyTagsOnCharacterSelect } from './tags.js';
|
import { appendTagToList, createTagMapFromList, getTagsList, applyTagsOnCharacterSelect, tag_map } from './tags.js';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
selected_group,
|
selected_group,
|
||||||
@@ -786,6 +786,7 @@ async function deleteGroup(id) {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
selected_group = null;
|
selected_group = null;
|
||||||
|
delete tag_map[id];
|
||||||
resetChatState();
|
resetChatState();
|
||||||
clearChat();
|
clearChat();
|
||||||
printMessages();
|
printMessages();
|
||||||
|
Reference in New Issue
Block a user