mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-07 16:19:09 +00:00
Fix approval ownership check and render decided cards
Use thread.isOwner with a false fallback instead of comparing session login to thread.id. Render full approvals list so approved/rejected cards remain visible after mutation, rather than filtering to pending-only and hiding the transition state. Remove now-unused useSession import.
This commit is contained in:
parent
fcda26b92d
commit
6bca20c934
1 changed files with 4 additions and 8 deletions
|
|
@ -29,7 +29,6 @@ import {
|
||||||
useWorkflowApprovals,
|
useWorkflowApprovals,
|
||||||
} from "@/lib/agents/queries"
|
} from "@/lib/agents/queries"
|
||||||
import { WorkflowApprovalCard } from "@/components/agents/WorkflowApprovalCard"
|
import { WorkflowApprovalCard } from "@/components/agents/WorkflowApprovalCard"
|
||||||
import { useSession } from "@/lib/session"
|
|
||||||
|
|
||||||
interface AgentThreadViewProps {
|
interface AgentThreadViewProps {
|
||||||
thread: AgentThread
|
thread: AgentThread
|
||||||
|
|
@ -136,12 +135,9 @@ export function AgentThreadView({ thread }: AgentThreadViewProps) {
|
||||||
const approvalsQuery = useWorkflowApprovals(thread.id)
|
const approvalsQuery = useWorkflowApprovals(thread.id)
|
||||||
const approveMutation = useApproveWorkflowPush(thread.id)
|
const approveMutation = useApproveWorkflowPush(thread.id)
|
||||||
const rejectMutation = useRejectWorkflowPush(thread.id)
|
const rejectMutation = useRejectWorkflowPush(thread.id)
|
||||||
const session = useSession()
|
|
||||||
|
|
||||||
const pendingApprovals = approvalsQuery.data?.filter(
|
const approvals = approvalsQuery.data
|
||||||
(a) => a.status === "pending"
|
const isApprovalOwner = thread.isOwner ?? false
|
||||||
)
|
|
||||||
const isApprovalOwner = thread.isOwner ?? session.data?.login === thread.id
|
|
||||||
|
|
||||||
const hasWorkflowApprovalError = useMemo(
|
const hasWorkflowApprovalError = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -202,9 +198,9 @@ export function AgentThreadView({ thread }: AgentThreadViewProps) {
|
||||||
)}
|
)}
|
||||||
{hasConversation ? (
|
{hasConversation ? (
|
||||||
<div className="relative flex min-h-0 flex-1 flex-col overflow-hidden">
|
<div className="relative flex min-h-0 flex-1 flex-col overflow-hidden">
|
||||||
{pendingApprovals && pendingApprovals.length > 0 && (
|
{approvals && approvals.length > 0 && (
|
||||||
<div className="shrink-0 px-4 pt-4">
|
<div className="shrink-0 px-4 pt-4">
|
||||||
{pendingApprovals.map((approval) => (
|
{approvals.map((approval) => (
|
||||||
<WorkflowApprovalCard
|
<WorkflowApprovalCard
|
||||||
key={approval.fingerprint}
|
key={approval.fingerprint}
|
||||||
approval={approval}
|
approval={approval}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue