task bucket fixes and task creation clarity
This commit is contained in:
+22
-2
@@ -346,8 +346,7 @@ export const matchesFilter = (task: Task) => {
|
||||
|
||||
// EXCLUDE Buckets from the main "Mine" view
|
||||
// The user wants to see "Direct Shares" (User Tags), not "Bucket Subscriptions" here.
|
||||
const isBucket = store.buckets.some(b => b.name.toLowerCase() === tagName.toLowerCase());
|
||||
if (isBucket) return false;
|
||||
if (isBucketTag(tagName)) return false;
|
||||
|
||||
return task.tags?.some(t => t.toLowerCase() === tagName.toLowerCase());
|
||||
}
|
||||
@@ -755,6 +754,7 @@ const shouldTaskBeVisible = (task: any, currentUserId: string): boolean => {
|
||||
// We ignore the rule.ownerId check (which would match the task.user)
|
||||
// and instead match purely on the tag.
|
||||
if (rule.ownerId === rule.targetUserId && rule.type === 'tag') {
|
||||
if (isBucketTag(rule.tagName || "")) return false;
|
||||
const tags: string[] = task.tags || [];
|
||||
return tags.some(t => t.toLowerCase() === (rule.tagName || "").toLowerCase());
|
||||
}
|
||||
@@ -787,6 +787,26 @@ const isTaskInSubscribedBucket = (task: any): boolean => {
|
||||
});
|
||||
};
|
||||
|
||||
// Helper: detect bucket tags robustly (case-insensitive, with or without '@')
|
||||
const isBucketTag = (tagName: string): boolean => {
|
||||
const raw = (tagName || "").trim().toLowerCase();
|
||||
if (!raw) return false;
|
||||
const normalized = raw.startsWith("@") ? raw.slice(1) : raw;
|
||||
|
||||
const bucketNameMatch = store.buckets.some(b => {
|
||||
const bName = (b.name || "").trim().toLowerCase();
|
||||
return normalized === bName || raw === `@${bName}`;
|
||||
});
|
||||
if (bucketNameMatch) return true;
|
||||
|
||||
const bucketTagDefMatch = store.tagDefinitions.some(d => {
|
||||
if (!d.isBucket) return false;
|
||||
const dName = (d.name || "").trim().toLowerCase();
|
||||
return raw === dName || normalized === dName || raw === `@${dName}`;
|
||||
});
|
||||
return bucketTagDefMatch;
|
||||
};
|
||||
|
||||
export const subscribeToRealtime = async () => {
|
||||
// Unsubscribe first to avoid duplicates
|
||||
await pb.collection(TASGRID_COLLECTION).unsubscribe('*');
|
||||
|
||||
Reference in New Issue
Block a user