Merge pull request #3653 from SillyTavern/fix-group-create-tags Fix group creation inheriting tags from characters[0]

13a3f4772e943398168f06a36c2af6e644df1bc1

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +5 -5Ignore whitespace
public/scripts/tags.js+5 -5
@@ -1251,7 +1251,7 @@ function onCharacterCreateClick() {
1251}1251}
12521252
1253function onGroupCreateClick() {1253function onGroupCreateClick() {
1254 // Nothing to do here at the moment. Tags in group interface get automatically redrawn.1254 $('#groupTagList').empty();
1255}1255}
12561256
1257export function applyTagsOnCharacterSelect(chid = null) {1257export function applyTagsOnCharacterSelect(chid = null) {
@@ -1259,11 +1259,11 @@ export function applyTagsOnCharacterSelect(chid = null) {
1259 if (menu_type === 'create') {1259 if (menu_type === 'create') {
1260 const currentTagIds = $('#tagList').find('.tag').map((_, el) => $(el).attr('id')).get();1260 const currentTagIds = $('#tagList').find('.tag').map((_, el) => $(el).attr('id')).get();
1261 const currentTags = tags.filter(x => currentTagIds.includes(x.id));1261 const currentTags = tags.filter(x => currentTagIds.includes(x.id));
1262 printTagList($('#tagList'), { forEntityOrKey: null, tags: currentTags, tagOptions: { removable: true } });1262 printTagList($('#tagList'), { forEntityOrKey: undefined, tags: currentTags, tagOptions: { removable: true } });
1263 return;1263 return;
1264 }1264 }
12651265
1266 chid = chid ?? Number(this_chid);1266 chid = chid ?? (this_chid !== undefined ? Number(this_chid) : undefined);
1267 printTagList($('#tagList'), { forEntityOrKey: chid, tagOptions: { removable: true } });1267 printTagList($('#tagList'), { forEntityOrKey: chid, tagOptions: { removable: true } });
1268}1268}
12691269
@@ -1272,11 +1272,11 @@ export function applyTagsOnGroupSelect(groupId = null) {
1272 if (menu_type === 'group_create') {1272 if (menu_type === 'group_create') {
1273 const currentTagIds = $('#groupTagList').find('.tag').map((_, el) => $(el).attr('id')).get();1273 const currentTagIds = $('#groupTagList').find('.tag').map((_, el) => $(el).attr('id')).get();
1274 const currentTags = tags.filter(x => currentTagIds.includes(x.id));1274 const currentTags = tags.filter(x => currentTagIds.includes(x.id));
1275 printTagList($('#groupTagList'), { forEntityOrKey: null, tags: currentTags, tagOptions: { removable: true } });1275 printTagList($('#groupTagList'), { forEntityOrKey: undefined, tags: currentTags, tagOptions: { removable: true } });
1276 return;1276 return;
1277 }1277 }
12781278
1279 groupId = groupId ?? Number(selected_group);1279 groupId = groupId ?? (selected_group ? Number(selected_group) : undefined);
1280 printTagList($('#groupTagList'), { forEntityOrKey: groupId, tagOptions: { removable: true } });1280 printTagList($('#groupTagList'), { forEntityOrKey: groupId, tagOptions: { removable: true } });
1281}1281}
12821282