task sharing restructure seems working

This commit is contained in:
2026-03-19 17:41:56 -05:00
parent a4d3da984b
commit 7f781edd89
+14 -1
View File
@@ -648,6 +648,7 @@ export const matchesFilter = (task: Task) => {
) || bucketRefs.some(context => context.id === (ctx as { bucketId: string }).bucketId); ) || bucketRefs.some(context => context.id === (ctx as { bucketId: string }).bucketId);
if (!inCurrentBucket) return false; if (!inCurrentBucket) return false;
} else { } else {
if (hasHandoffBucket) return false;
if (task.ownerId !== (ctx as { userId: string }).userId) return false; if (task.ownerId !== (ctx as { userId: string }).userId) return false;
} }
@@ -2052,9 +2053,21 @@ const checkForHandoffs = (task: Task, updates: Partial<Task>): Partial<Task> =>
const context = getContextByRef(ref); const context = getContextByRef(ref);
if (!context || context.policy !== "handoff") continue; if (!context || context.policy !== "handoff") continue;
if (context.kind === "user" && context.targetUserId) { if (context.kind === "user" && context.targetUserId) {
const senderPersonalContext = getPersonalContext(currentUserId);
const nextShareRefs = senderPersonalContext
? refs.filter(existingRef => !(
existingRef.kind === "user" &&
(existingRef.contextId === senderPersonalContext.id || existingRef.key === senderPersonalContext.key)
))
: refs;
const labelTags = updates.labelTags || task.labelTags;
const noteRefs = updates.noteRefs || task.noteRefs;
const favoriteTag = (updates.tags || task.tags || []).find(tag => tag.endsWith("_favorite__"));
return { return {
...updates, ...updates,
ownerId: context.targetUserId ownerId: context.targetUserId,
shareRefs: nextShareRefs,
tags: buildTaskTags(labelTags, nextShareRefs, noteRefs, favoriteTag)
}; };
} }
} }