share rule modes working

This commit is contained in:
2026-02-17 15:41:51 -06:00
parent e5c7666a2d
commit 9a3bd4cca3
2 changed files with 21 additions and 5 deletions
+19 -4
View File
@@ -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);
}
}
}