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') {
createOrEditCharacter();
}
if (popup_type === 'del_group') {
const groupId = $('#dialogue_popup').data('group_id');
if (groupId) {
deleteGroup(groupId);
}
}
//Make a new chat for selected character
if (
popup_type == 'new_chat' &&

View File

@ -24,7 +24,6 @@ import {
characters,
default_avatar,
addOneMessage,
callPopup,
clearChat,
Generate,
select_rm_info,
@ -75,7 +74,7 @@ import {
import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js';
import { FILTER_TYPES, FilterHelper } from './filters.js';
import { isExternalMediaAllowed } from './chats.js';
import { POPUP_TYPE, callGenericPopup } from './popup.js';
import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
export {
selected_group,
@ -1300,14 +1299,20 @@ function isGroupMemberDisabled(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) {
toastr.warning('Not so fast! Wait for the characters to stop typing before deleting the group.');
return;
}
$('#dialogue_popup').data('group_id', openGroupId);
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');
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>');
if (confirm) {
deleteGroup(openGroupId);
}
}
async function onFavoriteGroupClick() {
@ -1476,8 +1481,7 @@ async function uploadGroupAvatar(event) {
}
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) {
return;
}