Fix group tag list not updating
This commit is contained in:
parent
33cec69df9
commit
3a5dfadac5
|
@ -178,6 +178,8 @@ import {
|
||||||
tag_filter_types,
|
tag_filter_types,
|
||||||
compareTagsForSort,
|
compareTagsForSort,
|
||||||
initTags,
|
initTags,
|
||||||
|
applyTagsOnCharacterSelect,
|
||||||
|
applyTagsOnGroupSelect,
|
||||||
} from './scripts/tags.js';
|
} from './scripts/tags.js';
|
||||||
import {
|
import {
|
||||||
SECRET_KEYS,
|
SECRET_KEYS,
|
||||||
|
@ -1306,6 +1308,10 @@ export async function printCharacters(fullRefresh = false) {
|
||||||
printTagFilters(tag_filter_types.character);
|
printTagFilters(tag_filter_types.character);
|
||||||
printTagFilters(tag_filter_types.group_member);
|
printTagFilters(tag_filter_types.group_member);
|
||||||
|
|
||||||
|
// We are also always reprinting the lists on character/group edit window, as these ones doesn't get updated otherwise
|
||||||
|
applyTagsOnCharacterSelect();
|
||||||
|
applyTagsOnGroupSelect();
|
||||||
|
|
||||||
const entities = getEntitiesList({ doFilter: true });
|
const entities = getEntitiesList({ doFilter: true });
|
||||||
|
|
||||||
$('#rm_print_characters_pagination').pagination({
|
$('#rm_print_characters_pagination').pagination({
|
||||||
|
|
|
@ -73,7 +73,7 @@ import {
|
||||||
depth_prompt_role_default,
|
depth_prompt_role_default,
|
||||||
shouldAutoContinue,
|
shouldAutoContinue,
|
||||||
} from '../script.js';
|
} from '../script.js';
|
||||||
import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map } 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';
|
||||||
|
|
||||||
|
@ -1356,7 +1356,7 @@ function select_group_chats(groupId, skipAnimation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// render tags
|
// render tags
|
||||||
printTagList($('#groupTagList'), { forEntityOrKey: groupId, tagOptions: { removable: true } });
|
applyTagsOnGroupSelect(groupId);
|
||||||
|
|
||||||
// render characters list
|
// render characters list
|
||||||
printGroupCandidates();
|
printGroupCandidates();
|
||||||
|
|
|
@ -1046,15 +1046,16 @@ function onGroupCreateClick() {
|
||||||
// Nothing to do here at the moment. Tags in group interface get automatically redrawn.
|
// Nothing to do here at the moment. Tags in group interface get automatically redrawn.
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyTagsOnCharacterSelect() {
|
export function applyTagsOnCharacterSelect(chid = null) {
|
||||||
//clearTagsFilter();
|
//clearTagsFilter();
|
||||||
const chid = Number(this_chid);
|
chid = chid ?? Number(this_chid);
|
||||||
printTagList($('#tagList'), { forEntityOrKey: chid, tagOptions: { removable: true } });
|
printTagList($('#tagList'), { forEntityOrKey: chid, tagOptions: { removable: true } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyTagsOnGroupSelect() {
|
export function applyTagsOnGroupSelect(groupId = null) {
|
||||||
//clearTagsFilter();
|
//clearTagsFilter();
|
||||||
// Nothing to do here at the moment. Tags in group interface get automatically redrawn.
|
groupId = groupId ?? Number(selected_group);
|
||||||
|
printTagList($('#groupTagList'), { forEntityOrKey: groupId, tagOptions: { removable: true } });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1596,21 +1597,6 @@ function registerTagsSlashCommands() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTagsList() {
|
|
||||||
switch (menu_type) {
|
|
||||||
case 'characters':
|
|
||||||
printTagFilters(tag_filter_types.character);
|
|
||||||
printTagFilters(tag_filter_types.group_member);
|
|
||||||
break;
|
|
||||||
case 'character_edit':
|
|
||||||
applyTagsOnCharacterSelect();
|
|
||||||
break;
|
|
||||||
case 'group_edit':
|
|
||||||
select_group_chats(selected_group, true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'tag-add',
|
name: 'tag-add',
|
||||||
returns: 'true/false - Whether the tag was added or was assigned already',
|
returns: 'true/false - Whether the tag was added or was assigned already',
|
||||||
|
@ -1621,7 +1607,6 @@ function registerTagsSlashCommands() {
|
||||||
const tag = paraGetTag(tagName, { allowCreate: true });
|
const tag = paraGetTag(tagName, { allowCreate: true });
|
||||||
if (!tag) return 'false';
|
if (!tag) return 'false';
|
||||||
const result = addTagToEntity(tag, key);
|
const result = addTagToEntity(tag, key);
|
||||||
updateTagsList();
|
|
||||||
return String(result);
|
return String(result);
|
||||||
},
|
},
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
|
@ -1656,7 +1641,6 @@ function registerTagsSlashCommands() {
|
||||||
const tag = paraGetTag(tagName);
|
const tag = paraGetTag(tagName);
|
||||||
if (!tag) return 'false';
|
if (!tag) return 'false';
|
||||||
const result = removeTagFromEntity(tag, key);
|
const result = removeTagFromEntity(tag, key);
|
||||||
updateTagsList();
|
|
||||||
return String(result);
|
return String(result);
|
||||||
},
|
},
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
|
|
Loading…
Reference in New Issue