feat: integrate impersonated user handling for task completion

This commit is contained in:
Mo Tarbin
2025-09-27 20:29:28 -04:00
parent b367410aaf
commit bdd73135f0

View File

@@ -32,6 +32,7 @@ import {
Typography,
} from '@mui/joy'
import { useState } from 'react'
import { useImpersonateUser } from '../../contexts/ImpersonateUserContext'
import { useUserProfile } from '../../queries/UserQueries'
import { CompleteSubTask } from '../../utils/Fetcher'
@@ -312,6 +313,7 @@ const SubTasks = ({
}) => {
const [newTask, setNewTask] = useState('')
const { data: userProfile } = useUserProfile()
const { impersonatedUser } = useImpersonateUser()
const topLevelTasks = tasks.filter(task => task.parentId === null)
@@ -338,7 +340,7 @@ const SubTasks = ({
? {
...task,
completedAt: newCompletedAt,
completedBy: userProfile?.id,
completedBy: impersonatedUser?.userId || userProfile?.id,
}
: task,
)