mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Deduplicate auto-added t-tags to prevent duplicates on re-save
This commit is contained in:
1 file changed
+6
-3
+6
-3
@@ -82,13 +82,16 @@ export async function buildAppEvent(
|
||||
}
|
||||
}
|
||||
|
||||
// Add t-tags for categorization (shakespeare + template name)
|
||||
// Add t-tags for categorization (shakespeare + template name), skipping duplicates
|
||||
if (opts?.fs && opts.cwd) {
|
||||
tags.push(['t', 'shakespeare']);
|
||||
const existingTTags = new Set(input.tTags?.map(t => t.trim().toLowerCase()) ?? []);
|
||||
if (!existingTTags.has('shakespeare')) {
|
||||
tags.push(['t', 'shakespeare']);
|
||||
}
|
||||
try {
|
||||
const dotAI = new DotAI(opts.fs, opts.cwd);
|
||||
const template = await dotAI.readTemplate();
|
||||
if (template) {
|
||||
if (template && !existingTTags.has(template.name.toLowerCase())) {
|
||||
tags.push(['t', template.name.toLowerCase()]);
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user