share rule modes working
This commit is contained in:
+19
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,8 @@ export const SettingsView: Component = () => {
|
||||
<Tag size={14} class="text-muted-foreground shrink-0" />
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-medium truncate flex items-center gap-2">
|
||||
{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 ? <Users size={10} class="text-muted-foreground" /> : <Archive size={10} class="text-muted-foreground" />}
|
||||
</p>
|
||||
<p class="text-[10px] text-muted-foreground uppercase tracking-wider flex items-center gap-1">
|
||||
|
||||
Reference in New Issue
Block a user