cleaned up process of post-chat deletion handling

not a smart solution, but it works without error
This commit is contained in:
RossAsscends
2023-03-24 15:21:06 +09:00
parent f45ea2a5a2
commit 662cce8c6c

View File

@ -702,8 +702,22 @@ async function delChat(chatfile) {
}), }),
}); });
if (response.ok === true) { if (response.ok === true) {
//close past chat popup
$("#select_chat_cross").click();
//this is a copy of what 'start new chat' does, just without the popup and confirmation
//not an ideal solution, and needs to be smarter
clearChat(); clearChat();
chat.length = 0;
characters[this_chid].chat = name2 + " - " + humanizedDateTime();
$("#selected_chat_pole").val(characters[this_chid].chat);
saveCharacterDebounced();
getChat(); getChat();
//open the history view again after 100ms
setTimeout(function () { $("#option_select_chat").click() }, 100);
//hide option popup menu
$("#options").hide();
} }
} }
@ -3229,9 +3243,9 @@ $(document).ready(function () {
bg_file_for_del.parent().remove(); bg_file_for_del.parent().remove();
} }
if (popup_type == "del_chat") { if (popup_type == "del_chat") {
$("#select_chat_cross").click();
delChat(chat_file_for_del); delChat(chat_file_for_del);
$("#option_select_chat").click();
} }
if (popup_type == "del_ch") { if (popup_type == "del_ch") {
console.log( console.log(