import type { Outcome, Pull } from "@refs/backend/contract"; import { formText } from "./session"; export const THREAD_INTENTS = new Set(["thread-reply", "thread-resolve", "thread-reopen"]); /** Runs a review thread card's reply, resolve or reopen against `pull`. */ export function threadAction(pull: Pull, intent: string, form: FormData): Promise { const thread = Number(formText(form, "thread")); if (intent === "thread-resolve") return pull.resolveThread(thread); if (intent === "thread-reopen") return pull.reopenThread(thread); return pull.replyToThread(thread, formText(form, "body"), formText(form, "assign") === "1"); }