Don't show tag import if no tags to import

This commit is contained in:
Wolfsblvt 2024-06-24 17:17:42 +02:00
parent 4b58a822db
commit b188c176fd
1 changed files with 6 additions and 2 deletions

View File

@ -717,7 +717,7 @@ async function importTags(character, { forceShow = false } = {}) {
// Gather the tags to import based on the selected setting
const tagNamesToImport = await handleTagImport(character, { forceShow });
if (!tagNamesToImport?.length) {
toastr.info('No tags imported', 'Importing Tags');
toastr.info('No tags to import', 'Importing Tags');
return;
}
@ -756,8 +756,12 @@ async function handleTagImport(character, { forceShow = false } = {}) {
return [...existingTags, ...newTags, ...folderTags].map(t => t.name);
case tag_import_setting.ONLY_EXISTING:
return [...existingTags, ...folderTags].map(t => t.name);
case tag_import_setting.ASK:
case tag_import_setting.ASK: {
if (!existingTags.length && !newTags.length && !folderTags.length) {
return [];
}
return await showTagImportPopup(character, existingTags, newTags, folderTags);
}
case tag_import_setting.NONE:
return [];
default: throw new Error(`Invalid tag import setting: ${setting}`);