tag list fixes

This commit is contained in:
2026-02-27 11:05:29 -06:00
parent 2abf4ae5a9
commit 41c9e2f3a0
2 changed files with 14 additions and 14 deletions
+10 -10
View File
@@ -1619,8 +1619,8 @@ export const syncSystemTagsAndRules = async () => {
// --- Sync Bucket Tags ---
for (const bucket of store.buckets) {
const bucketTagName = `@${bucket.name}`;
const tagExists = tagDefinitions.find(t => t.name === bucketTagName);
if (!tagExists) {
const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === bucketTagName.toLowerCase());
if (!tagExistsExact) {
try {
const record = await pb.collection(TAGS_COLLECTION).create({
user: currentUserId,
@@ -1641,10 +1641,10 @@ export const syncSystemTagsAndRules = async () => {
} catch (e) {
console.error(`Failed to create bucket tag ${bucketTagName}`, e);
}
} else if (!tagExists.isBucket) {
} else if (!tagExistsExact.isBucket) {
try {
await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isBucket: true });
setStore("tagDefinitions", d => d.id === tagExists.id, { isBucket: true });
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isBucket: true });
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isBucket: true });
} catch (e) {
console.error(`Failed to flag tag ${bucketTagName} as bucket`, e);
}
@@ -1678,8 +1678,8 @@ export const syncSystemTagsAndRules = async () => {
if (!originalName) continue;
const userName = `@${originalName}`;
const tagExists = tagDefinitions.find(t => t.name === userName);
if (!tagExists) {
const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === userName.toLowerCase());
if (!tagExistsExact) {
try {
const record = await pb.collection(TAGS_COLLECTION).create({
user: currentUserId,
@@ -1700,10 +1700,10 @@ export const syncSystemTagsAndRules = async () => {
} catch (e) {
// console.error(`Failed to create user tag ${userName}`, e);
}
} else if (!tagExists.isUser) {
} else if (!tagExistsExact.isUser) {
try {
await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isUser: true });
setStore("tagDefinitions", d => d.id === tagExists.id, { isUser: true });
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isUser: true });
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isUser: true });
} catch (e) {
console.error(`Failed to flag tag ${userName} as user`, e);
}