From 98ce57b1d9a255d191cfb83673421af66527a971 Mon Sep 17 00:00:00 2001 From: Alma Date: Sat, 12 Apr 2025 19:29:19 +0200 Subject: [PATCH] working leantime widget 70 --- app/api/leantime/tasks/route.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/api/leantime/tasks/route.ts b/app/api/leantime/tasks/route.ts index 6d13e4c8..1f313e30 100644 --- a/app/api/leantime/tasks/route.ts +++ b/app/api/leantime/tasks/route.ts @@ -160,8 +160,15 @@ export async function GET(request: NextRequest) { status: task.status }); - // Only include tasks where the current user is assigned - return task.editorId === userId.toString() || task.editorId === userId; + // Convert both to strings for comparison to handle any type mismatches + const taskEditorId = String(task.editorId).trim(); + const currentUserId = String(userId).trim(); + + // Also check if the user is in the assignedTo array if it exists + const isAssignedToUser = Array.isArray(task.assignedTo) && + task.assignedTo.some((id: any) => String(id).trim() === currentUserId); + + return taskEditorId === currentUserId || isAssignedToUser; }) .map((task: any) => ({ id: task.id.toString(),