From 941c67139a7aec5a5d4520f1ddc3b7f7c06f4ef6 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 19 Aug 2023 21:44:15 +0300 Subject: [PATCH] Fix opening groups after conversion --- public/scripts/bookmarks.js | 7 +++---- public/scripts/group-chats.js | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/scripts/bookmarks.js b/public/scripts/bookmarks.js index ba77eda84..294f0266e 100644 --- a/public/scripts/bookmarks.js +++ b/public/scripts/bookmarks.js @@ -1,7 +1,6 @@ import { characters, saveChat, - sendSystemMessage, system_messages, system_message_types, this_chid, @@ -19,6 +18,7 @@ import { getGroupPastChats, group_activation_strategy, groups, + openGroupById, openGroupChat, saveGroupBookmarkChat, selected_group, @@ -301,13 +301,12 @@ async function convertSoloToGroupChat() { } // Click on the freshly selected group to open it - $(`.group_select[grid="${group.id}"]`).click(); + await openGroupById(group.id); - await delay(1); toastr.success('The chat has been successfully converted!'); } -$(document).ready(function () { +jQuery(function () { $('#option_new_bookmark').on('click', saveBookmarkMenu); $('#option_back_to_main').on('click', backToMainChat); $('#option_convert_to_group').on('click', convertSoloToGroupChat); diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index b5f51678b..e94b3c1f4 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -1234,9 +1234,7 @@ function updateFavButtonState(state) { $("#group_favorite_button").toggleClass('fav_off', !fav_grp_checked); } -async function selectGroup() { - const groupId = $(this).data("id"); - +export async function openGroupById(groupId) { if (!is_send_press && !is_group_generating) { if (selected_group !== groupId) { cancelTtsPlay(); @@ -1548,7 +1546,10 @@ function doCurMemberListPopout() { } jQuery(() => { - $(document).on("click", ".group_select", selectGroup); + $(document).on("click", ".group_select", function () { + const groupId = $(this).data("id"); + openGroupById(groupId); + }); $("#rm_group_filter").on("input", filterGroupMembers); $("#rm_group_submit").on("click", createGroup); $("#rm_group_scenario").on("click", setScenarioOverride);