From 9a3bd4cca3f335df4e63259c7dbe88d66aca5cfd Mon Sep 17 00:00:00 2001 From: Timothy Cardoza Date: Tue, 17 Feb 2026 15:41:51 -0600 Subject: [PATCH] share rule modes working --- src/store/index.ts | 23 +++++++++++++++++++---- src/views/SettingsView.tsx | 3 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index a86bb81..8000d7f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1364,12 +1364,27 @@ export const syncSystemTagsAndRules = async () => { } catch (e) { console.error(`Failed to create bucket tag ${bucket.name}`, e); } - } else if (!tagExists.isBucket) { + } + // --- Sync Bucket System Rule --- + // Ensure a ShareRule exists for this bucket so it appears in "System Rules" + const bucketRuleExists = normalizedRules.some(r => + r.ownerId === currentUserId && + r.targetUserId === currentUserId && + r.type === 'tag' && + r.tagName === bucket.name + ); + + if (!bucketRuleExists) { try { - await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isBucket: true }); - setStore("tagDefinitions", d => d.id === tagExists.id, { isBucket: true }); + await pb.collection(SHARE_RULES_COLLECTION).create({ + ownerId: currentUserId, + targetUserId: currentUserId, + type: 'tag', + tagName: bucket.name, + share_mode: 'SEND_TASK' + }); } catch (e) { - console.error(`Failed to flag tag ${bucket.name} as bucket`, e); + console.error(`Failed to ensure system rule for bucket ${bucket.name}`, e); } } } diff --git a/src/views/SettingsView.tsx b/src/views/SettingsView.tsx index ccad2c8..a6911f8 100644 --- a/src/views/SettingsView.tsx +++ b/src/views/SettingsView.tsx @@ -336,7 +336,8 @@ export const SettingsView: Component = () => {

- {getUserName(rule.targetUserId)} + {/* If it's a user tag, show the person's name. If it's a bucket, show the bucket name (tagName). */} + {tagDef?.isUser ? getUserName(rule.targetUserId) : rule.tagName} {tagDef?.isUser ? : }