tag list fixes
This commit is contained in:
+10
-10
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user