task sharing restructure seems working
This commit is contained in:
+14
-1
@@ -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)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user