mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-12 10:00:36 +01:00
fix /delchat for characters with lots of chat files
This commit is contained in:
parent
2815990589
commit
f0cffb3dd9
@ -7817,15 +7817,11 @@ async function doImpersonate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function doDeleteChat() {
|
async function doDeleteChat() {
|
||||||
$('#option_select_chat').trigger('click', { fromSlashCommand: true });
|
await displayPastChats();
|
||||||
await delay(100);
|
|
||||||
let currentChatDeleteButton = $('.select_chat_block[highlight=\'true\']').parent().find('.PastChat_cross');
|
let currentChatDeleteButton = $('.select_chat_block[highlight=\'true\']').parent().find('.PastChat_cross');
|
||||||
$(currentChatDeleteButton).trigger('click', { fromSlashCommand: true });
|
$(currentChatDeleteButton).trigger('click');
|
||||||
await delay(1);
|
await delay(1);
|
||||||
$('#dialogue_popup_ok').trigger('click');
|
$('#dialogue_popup_ok').trigger('click', { fromSlashCommand: true });
|
||||||
//200 delay needed let the past chat view reshow first
|
|
||||||
await delay(200);
|
|
||||||
$('#select_chat_cross').trigger('click');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPwaMode = window.navigator.standalone;
|
const isPwaMode = window.navigator.standalone;
|
||||||
@ -8208,7 +8204,8 @@ jQuery(async function () {
|
|||||||
$('#character_popup').css('display', 'none');
|
$('#character_popup').css('display', 'none');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#dialogue_popup_ok').click(async function (e) {
|
$('#dialogue_popup_ok').click(async function (e, customData) {
|
||||||
|
const fromSlashCommand = customData?.fromSlashCommand || false;
|
||||||
dialogueCloseStop = false;
|
dialogueCloseStop = false;
|
||||||
$('#shadow_popup').transition({
|
$('#shadow_popup').transition({
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
@ -8238,14 +8235,16 @@ jQuery(async function () {
|
|||||||
await delChat(chat_file_for_del);
|
await delChat(chat_file_for_del);
|
||||||
}
|
}
|
||||||
|
|
||||||
//open the history view again after 2seconds (delay to avoid edge cases for deleting last chat)
|
if (fromSlashCommand) { // When called from `/delchat` command, don't re-open the history view.
|
||||||
//hide option popup menu
|
$('#options').hide(); // hide option popup menu
|
||||||
setTimeout(function () {
|
|
||||||
$('#option_select_chat').click();
|
|
||||||
$('#options').hide();
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}, 2000);
|
} else { // Open the history view again after 2 seconds (delay to avoid edge cases for deleting last chat).
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#option_select_chat').click();
|
||||||
|
$('#options').hide(); // hide option popup menu
|
||||||
|
hideLoader();
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (popup_type == 'del_ch') {
|
if (popup_type == 'del_ch') {
|
||||||
const deleteChats = !!$('#del_char_checkbox').prop('checked');
|
const deleteChats = !!$('#del_char_checkbox').prop('checked');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user