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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user