Move group chat popups to new popup

This commit is contained in:
Wolfsblvt 2024-06-26 05:56:15 +02:00
parent ec58d9272a
commit 4e7232f13e
2 changed files with 11 additions and 14 deletions

View File

@ -9210,13 +9210,6 @@ jQuery(async function () {
if (popup_type == 'alternate_greeting' && menu_type !== 'create') { if (popup_type == 'alternate_greeting' && menu_type !== 'create') {
createOrEditCharacter(); createOrEditCharacter();
} }
if (popup_type === 'del_group') {
const groupId = $('#dialogue_popup').data('group_id');
if (groupId) {
deleteGroup(groupId);
}
}
//Make a new chat for selected character //Make a new chat for selected character
if ( if (
popup_type == 'new_chat' && popup_type == 'new_chat' &&

View File

@ -24,7 +24,6 @@ import {
characters, characters,
default_avatar, default_avatar,
addOneMessage, addOneMessage,
callPopup,
clearChat, clearChat,
Generate, Generate,
select_rm_info, select_rm_info,
@ -75,7 +74,7 @@ import {
import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js'; import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js';
import { FILTER_TYPES, FilterHelper } from './filters.js'; import { FILTER_TYPES, FilterHelper } from './filters.js';
import { isExternalMediaAllowed } from './chats.js'; import { isExternalMediaAllowed } from './chats.js';
import { POPUP_TYPE, callGenericPopup } from './popup.js'; import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
export { export {
selected_group, selected_group,
@ -1300,14 +1299,20 @@ function isGroupMemberDisabled(avatarId) {
return Boolean(thisGroup && thisGroup.disabled_members.includes(avatarId)); return Boolean(thisGroup && thisGroup.disabled_members.includes(avatarId));
} }
function onDeleteGroupClick() { async function onDeleteGroupClick() {
if (!openGroupId) {
toastr.warning('Currently no group selected.');
return;
}
if (is_group_generating) { if (is_group_generating) {
toastr.warning('Not so fast! Wait for the characters to stop typing before deleting the group.'); toastr.warning('Not so fast! Wait for the characters to stop typing before deleting the group.');
return; return;
} }
$('#dialogue_popup').data('group_id', openGroupId); const confirm = await Popup.show.confirm('Delete the group?', '<p>This will also delete all your chats with that group. If you want to delete a single conversation, select a "View past chats" option in the lower left menu.</p>');
callPopup('<h3>Delete the group?</h3><p>This will also delete all your chats with that group. If you want to delete a single conversation, select a "View past chats" option in the lower left menu.</p>', 'del_group'); if (confirm) {
deleteGroup(openGroupId);
}
} }
async function onFavoriteGroupClick() { async function onFavoriteGroupClick() {
@ -1476,8 +1481,7 @@ async function uploadGroupAvatar(event) {
} }
async function restoreGroupAvatar() { async function restoreGroupAvatar() {
const confirm = await callPopup('<h3>Are you sure you want to restore the group avatar?</h3> Your custom image will be deleted, and a collage will be used instead.', 'confirm'); const confirm = await Popup.show.confirm('Are you sure you want to restore the group avatar?', 'Your custom image will be deleted, and a collage will be used instead.');
if (!confirm) { if (!confirm) {
return; return;
} }