working leantime widget 70
This commit is contained in:
parent
5b19f8727d
commit
98ce57b1d9
@ -160,8 +160,15 @@ export async function GET(request: NextRequest) {
|
|||||||
status: task.status
|
status: task.status
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only include tasks where the current user is assigned
|
// Convert both to strings for comparison to handle any type mismatches
|
||||||
return task.editorId === userId.toString() || task.editorId === userId;
|
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) => ({
|
.map((task: any) => ({
|
||||||
id: task.id.toString(),
|
id: task.id.toString(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user