A local-first multi-agent app development platform, built on PenguinHarness
fix(web): 工单的保存 / 解除阻塞 / 移动被拒时,框留着、原因也留在框里(7.44)
lmliheng37db5bca1c77
diff --git a/changelog/unreleased/2026-10-25-ticket-refusal.md b/changelog/unreleased/2026-10-25-ticket-refusal.mdnew file mode 100644index 00000000..bd0a51c2--- /dev/null+++ b/changelog/unreleased/2026-10-25-ticket-refusal.md@@ -0,0 +1,42 @@+# Tickets: a refused write keeps its question — and the reason++- **Date:** 2026-10-25+- **Type:** fix+- **Scope:** `web`+- **Breaking:** no++[中文](2026-10-25-ticket-refusal.zh.md)++A ticket's writes are asked in confirmation cards: saving an edited section, lifting a block, and+moving the ticket — the last one from the dialog's footer and, with the same card, from a card+dropped on another column of the board. Every one of them closed before its write landed, so a+refusal put the server's words in a toast that dismissed itself after a few seconds, over a panel+that had not changed: the button came alive again and nothing said why the ticket was still as it+was.++Each card now closes only on the path where its write landed; a refusal draws the server's words+inside the card, right above the button that retries it (`ConfirmModal`'s `refusal` slot, the+app's existing "Refused:" lead-in). Opening a card again drops the previous reason, which belonged+to the attempt it named; a write in flight takes one press only, and cancelling decides nothing.++## Details++- `features/company/ticket-dialog.tsx`: `run()` takes an optional `refuse` callback — a write with+ a card behind it reports the server's words back into that card, and a write with none (a+ progress note) keeps the toast. One `refusal` state serves the three cards (they cannot be up+ together, and each is cleared before it is raised). `commitSave`, `commitMove` and the new+ `commitUnblock` close their card inside the write instead of before it, so success is the only+ path that dismisses it, and `MoveTicketConfirm` grew the optional `refusal` it hands to the slot.+- `features/company/tickets-page.tsx`: the board's own `confirmMove` keeps a refusal in+ `moveRefusal` instead of a toast, closes the card only once the move landed, and clears the+ previous reason when a card is dropped on a new column.+- New browser tests `e2e/ticket-refusal.spec.mjs` (four: save, move from the dialog, unblock, move+ from the board): with the write refused at `page.route` 500, the card, its sentence and the+ ticket file on the server all stay (nothing in the notification region carries the words);+ cancelling and reopening shows no stale reason; the retry on the same card really writes — the+ card closes and the ticket takes the new title / column / block state.++## Compatibility++- No interface, wire-format, stored-data or dependency change: only *when* these cards close and+ *where* the reason is drawn. No new copy beyond the existing `S.common.refused` lead-in.diff --git a/changelog/unreleased/2026-10-25-ticket-refusal.zh.md b/changelog/unreleased/2026-10-25-ticket-refusal.zh.mdnew file mode 100644index 00000000..3760ac79--- /dev/null+++ b/changelog/unreleased/2026-10-25-ticket-refusal.zh.md@@ -0,0 +1,34 @@+# 工单:写入被拒时,确认框留着,原因也留在框里++- **Date:** 2026-10-25+- **Type:** fix+- **Scope:** `web`+- **Breaking:** no++[English](2026-10-25-ticket-refusal.md)++工单的每一次写入都先问一张确认框:保存某个改过的字段、解除阻塞、移动工单 —— 最后这个在详情框底栏有+入口,把看板上的卡片拖到另一列时问的也是同一张框。过去它们全都在写入之前就把框关掉,被拒时服务端原话+只落进一条几秒后自己消失的通知:面板一点没变,按钮又亮了,为什么这张工单还是原样却得凭那条一闪而过的+通知去想。++现在关框只发生在写入真正落地那条路径上;被拒时服务端原话画进框里、重试按钮正上方(`ConfirmModal` 的+`refusal` 槽,用的是应用既有的「操作被拒绝:」前缀)。重开这张框会先清掉上一次的原因 —— 那句话属于上次+那次尝试;一个写入在途时只认一次点击,取消不决定任何事。++## 细节++- `features/company/ticket-dialog.tsx`:`run()` 多一个可选的 `refuse` —— 背后有确认框的写入把服务端+ 原话交回那张框,没有框的写入(追加进度)仍走通知。三张框共用一份 `refusal` 状态(它们不会同时开着,+ 且每次开框前都先清空)。`commitSave`、`commitMove` 与新的 `commitUnblock` 把关框挪进写入内部,+ 只有成功那条路径才让框消失;`MoveTicketConfirm` 多一个可选 `refusal`,原样交给那个槽。+- `features/company/tickets-page.tsx`:看板自己的 `confirmMove` 把拒绝留在 `moveRefusal`(不再弹通知),+ 只有移动落地才关框;把卡片拖到新的一列时清掉上一次的原因。+- 新增浏览器用例 `e2e/ticket-refusal.spec.mjs`(四条:保存 / 详情框里的移动 / 解除阻塞 / 看板上的移动):+ 用 `page.route` 把那次写入拒成 500 之后,框、框里那句话与服务端上的工单文件都不变(通知区里没有那句+ 原话);取消后重开不带旧原因;在同一张框上重试才真正写进去 —— 框关掉,工单拿到新的标题 / 列 / 阻塞状态。++## 兼容性++- 没有接口、传输格式、已存数据或依赖变化:只改了这几张框「什么时候关」与「原因画在哪」。除既有的+ `S.common.refused` 前缀外没有新文案。diff --git a/packages/web/e2e/ticket-refusal.spec.mjs b/packages/web/e2e/ticket-refusal.spec.mjsnew file mode 100644index 00000000..cfc1e613--- /dev/null+++ b/packages/web/e2e/ticket-refusal.spec.mjs@@ -0,0 +1,319 @@+/**+ * Regression: a ticket's writes are asked in confirmation cards, and a refused write keeps the+ * card that asked — with the server's words inside it — instead of leaving only a toast behind.+ *+ * Three cards live in the ticket dialog (`features/company/ticket-dialog.tsx`): saving an edited+ * section, lifting a block, and moving the ticket from the footer. A fourth entry point raises+ * the same move card from the board (`features/company/tickets-page.tsx`, a card dropped on+ * another column) — one card, two doors. All four used to close before their write landed, so a+ * refusal put the reason in a toast that dismissed itself after a few seconds, over a panel that+ * had not changed and with the button live again and nothing saying why. Each card now goes only+ * once its write landed; a refusal leaves it standing with the reason drawn under its sentence+ * (`ConfirmModal`'s `refusal` slot), and reopening it does not carry the old reason.+ *+ * The organization and its ticket are made through the API rather than through the dialogs:+ * this spec is about the confirmations, not about creation. Company mode is off on a fresh+ * server, so each test turns the admin master switch on first (idempotent), and the Project gets+ * the mock as its model — nothing here needs the model, but a fresh Project without one would+ * hold the onboarding overlay over the board.+ */+import { test, expect, request } from "@playwright/test";+import { ADMIN_ID, ADMIN_PASSWORD, login, provisionAndLogin } from "./auth.mjs";++const BASE = process.env.BASE_URL;+const MOCK = process.env.MOCK_URL;+const P = "password123";+const ORG = "ticketrefuse";+const TITLE = "上线市场站点";+const RENAMED = "上线市场站点和博客";+const GOAL = "让插件市场能被人搜到,首页限时置顶卖出第一格曝光。";++/** The refusal the page paints; a 500 with its own words proves those words came back. */+const REFUSAL = { code: "ticket_files_locked", message: "the ticket files are mid-rewrite" };++/** The admin master switch, off by default: turned on server-wide before the flow starts. */+async function enableCompanyMode() {+ const adminCtx = await request.newContext();+ try {+ await login(adminCtx, ADMIN_ID, ADMIN_PASSWORD);+ const res = await adminCtx.put(`${BASE}/api/admin/settings`, { data: { companyMode: true } });+ if (!res.ok()) {+ throw new Error(`enable company mode failed: ${res.status()} ${await res.text()}`);+ }+ } finally {+ await adminCtx.dispose();+ }+}++/**+ * A fresh user with mock-model credentials, an organization with its CEO and one ticket owned by+ * that CEO. Returns the ids and a reader over the ticket as stored.+ */+async function setUp(page, tag) {+ await enableCompanyMode();+ const user = `${tag}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;+ await provisionAndLogin(page.request, user, P);+ const project = (await (await page.request.get(`${BASE}/api/projects`)).json()).projects[0];+ const projectId = project.projectId;+ const put = await page.request.put(`${BASE}/api/projects/${projectId}/models`, {+ data: {+ defaultModel: { provider: "custom", modelId: "claude-4-8" },+ models: [+ {+ provider: "custom",+ modelId: "claude-4-8",+ apiKey: "sk-mock",+ baseUrl: MOCK,+ contextWindow: 200000,+ },+ ],+ },+ });+ expect(put.ok(), `put models ${projectId}`).toBeTruthy();++ const orgBase = `${BASE}/api/projects/${projectId}/organizations`;+ const created = await page.request.post(orgBase, {+ data: { orgId: ORG, mission: "Publish the plugin marketplace and reach the top of search." },+ });+ expect(created.ok(), "create organization").toBeTruthy();++ const filed = await page.request.post(`${orgBase}/${ORG}/tickets`, {+ data: { title: TITLE, goal: GOAL, owner: `agent:${ORG}_ceo`, priority: "P1" },+ });+ expect(filed.ok(), "create ticket").toBeTruthy();+ const ticketId = (await filed.json()).ticketId;++ const ticketUrl = `${orgBase}/${ORG}/tickets/${ticketId}`;+ /** The ticket as the server holds it: its title and its column. */+ const stored = async () => await (await page.request.get(ticketUrl)).json();+ return { projectId, ticketUrl, ticketId, stored };+}++/** The board, and the card of the one ticket — a click anywhere on it opens the ticket. */+async function openBoard(page, projectId) {+ await page.goto(`/org/${projectId}/${ORG}/tickets`);+ await expect(page.getByText(TITLE, { exact: true }).first()).toBeVisible();+}++async function openTicket(page) {+ await page.locator("[data-ticket-column] button", { hasText: TITLE }).first().click();+ const dialog = page.getByRole("dialog", { name: TITLE });+ await expect(dialog).toBeVisible();+ return dialog;+}++/**+ * The card's own text with the refusal line dropped: a refused write adds one line under the+ * sentence ("操作被拒绝:…"), and that line is the only thing the refusal may change.+ */+async function cardText(card) {+ return (await card.innerText()).replace(/\n操作被拒绝:[^\n]*/, "");+}++/**+ * Refuse one of the ticket's writes, counting the attempts: a `500` with its own words is how the+ * test knows whose words came back, and the count is how it knows the page wrote exactly once.+ */+async function refuseWrite(page, ticketUrl, method, seen, suffix = "") {+ const pattern = `**${new URL(ticketUrl).pathname}${suffix}`;+ await page.route(pattern, async (route) => {+ if (route.request().method() !== method) return route.fallback();+ seen.push(route.request().url());+ await route.fulfill({+ status: 500,+ contentType: "application/json",+ body: JSON.stringify({ error: REFUSAL }),+ });+ });+ return pattern;+}++test("a refused save keeps the card, its sentence and the ticket file", async ({ page }) => {+ test.setTimeout(120_000);+ const { projectId, ticketUrl, stored } = await setUp(page, "r130save");+ await openBoard(page, projectId);+ const dialog = await openTicket(page);++ // The summary section's own "编辑" opens its fields in place; "保存" asks first.+ await dialog.getByRole("button", { name: "编辑", exact: true }).first().click();+ await dialog.getByRole("textbox", { name: "标题", exact: true }).fill(RENAMED);+ await dialog.getByRole("button", { name: "保存", exact: true }).click();+ const card = page.getByRole("dialog", { name: "保存修改" });+ await expect(card).toBeVisible();+ const sentence = await cardText(card);+ expect(sentence).toContain(`保存对「${TITLE}」的修改`);++ const writes = [];+ const pattern = await refuseWrite(page, ticketUrl, "PUT", writes);+ await card.getByRole("button", { name: "保存", exact: true }).click();++ // The reason is in the card that asked, and it is not a toast: the notification region never+ // carries the server's words, and the card reads exactly as before plus the one line.+ await expect(card.getByText(REFUSAL.message)).toBeVisible();+ await expect(page.getByRole("region", { name: "通知" })).not.toContainText(REFUSAL.message);+ expect(writes).toHaveLength(1);+ await expect(card).toBeVisible();+ expect(await cardText(card)).toBe(sentence);++ // Nothing was written: the file still holds the old title, and the fields keep the edit.+ expect((await stored()).title).toBe(TITLE);+ await expect(dialog.getByRole("textbox", { name: "标题", exact: true })).toHaveValue(RENAMED);++ // Closing the card decides nothing, and reopening it does not carry the old reason.+ await card.getByRole("button", { name: "取消" }).click();+ await expect(card).toHaveCount(0);+ await dialog.getByRole("button", { name: "保存", exact: true }).click();+ const again = page.getByRole("dialog", { name: "保存修改" });+ await expect(again).toBeVisible();+ await expect(again.getByText(REFUSAL.message)).toHaveCount(0);+ expect(await again.innerText()).toBe(sentence);++ // The retry lands: the card goes, the file takes the new title, and the dialog is renamed by it.+ await page.unroute(pattern);+ await again.getByRole("button", { name: "保存", exact: true }).click();+ await expect(again).toHaveCount(0);+ await expect.poll(async () => (await stored()).title).toBe(RENAMED);+ await expect(page.getByRole("dialog", { name: RENAMED })).toBeVisible();+});++test("a refused move from the dialog keeps the card, its sentence and the column", async ({+ page,+}) => {+ test.setTimeout(120_000);+ const { projectId, ticketUrl, stored } = await setUp(page, "r130move");+ await openBoard(page, projectId);+ const dialog = await openTicket(page);++ // The footer's own move: pick the column, then "移动" asks first. The select is the app's own+ // dropdown (a trigger button opening a listbox), not a native one.+ const picker = dialog.getByRole("button", { name: "移动工单" });+ await picker.click();+ await page.getByRole("option", { name: "进行中", exact: true }).click();+ await dialog.getByRole("button", { name: "移动", exact: true }).click();+ const card = page.getByRole("dialog", { name: "移动工单" });+ await expect(card).toBeVisible();+ const sentence = await cardText(card);+ expect(sentence).toContain(`将「${TITLE}」移到「进行中」?`);++ const writes = [];+ const pattern = await refuseWrite(page, ticketUrl, "POST", writes, "/move");+ await card.getByRole("button", { name: "确认", exact: true }).click();++ await expect(card.getByText(REFUSAL.message)).toBeVisible();+ await expect(page.getByRole("region", { name: "通知" })).not.toContainText(REFUSAL.message);+ expect(writes).toHaveLength(1);+ await expect(card).toBeVisible();+ expect(await cardText(card)).toBe(sentence);++ // Nothing was written: the ticket is still proposed, and the footer still has the column picked.+ expect((await stored()).status).toBe("proposed");+ await expect(picker).toContainText("进行中");++ // Closing the card decides nothing, and reopening it does not carry the old reason.+ await card.getByRole("button", { name: "取消" }).click();+ await expect(card).toHaveCount(0);+ await dialog.getByRole("button", { name: "移动", exact: true }).click();+ const again = page.getByRole("dialog", { name: "移动工单" });+ await expect(again).toBeVisible();+ await expect(again.getByText(REFUSAL.message)).toHaveCount(0);+ expect(await again.innerText()).toBe(sentence);++ // The retry lands: the card goes and the file records the column.+ await page.unroute(pattern);+ await again.getByRole("button", { name: "确认", exact: true }).click();+ await expect(again).toHaveCount(0);+ await expect.poll(async () => (await stored()).status).toBe("in_progress");+});++test("a refused unblock keeps the card, its sentence and the block", async ({ page }) => {+ test.setTimeout(120_000);+ const { projectId, ticketUrl, stored } = await setUp(page, "r130unblock");+ // Blocked through the API: the block dialog is not what this test is about.+ const blocked = await page.request.post(`${ticketUrl}/block`, {+ data: { reason: "等市场站点的备案下来" },+ });+ expect(blocked.ok(), "block the ticket").toBeTruthy();++ await openBoard(page, projectId);+ const dialog = await openTicket(page);+ await dialog.getByRole("button", { name: "解除阻塞", exact: true }).click();+ const card = page.getByRole("dialog", { name: "解除阻塞", exact: true });+ await expect(card).toBeVisible();+ const sentence = await cardText(card);+ expect(sentence).toContain(`解除「${TITLE}」的阻塞?`);++ const writes = [];+ const pattern = await refuseWrite(page, ticketUrl, "POST", writes, "/unblock");+ await card.getByRole("button", { name: "确认", exact: true }).click();++ await expect(card.getByText(REFUSAL.message)).toBeVisible();+ await expect(page.getByRole("region", { name: "通知" })).not.toContainText(REFUSAL.message);+ expect(writes).toHaveLength(1);+ await expect(card).toBeVisible();+ expect(await cardText(card)).toBe(sentence);++ // Nothing was written: the ticket is still blocked, so the footer still offers to lift it.+ expect((await stored()).blocked).toBeTruthy();++ // Closing the card decides nothing, and reopening it does not carry the old reason.+ await card.getByRole("button", { name: "取消" }).click();+ await expect(card).toHaveCount(0);+ await dialog.getByRole("button", { name: "解除阻塞", exact: true }).click();+ const again = page.getByRole("dialog", { name: "解除阻塞", exact: true });+ await expect(again).toBeVisible();+ await expect(again.getByText(REFUSAL.message)).toHaveCount(0);+ expect(await again.innerText()).toBe(sentence);++ // The retry lands: the card goes and the file no longer carries a block.+ await page.unroute(pattern);+ await again.getByRole("button", { name: "确认", exact: true }).click();+ await expect(again).toHaveCount(0);+ await expect.poll(async () => (await stored()).blocked).toBeFalsy();+});++test("a refused move from the board keeps the card, its sentence and the column", async ({+ page,+}) => {+ test.setTimeout(120_000);+ const { projectId, ticketUrl, stored } = await setUp(page, "r130board");+ await openBoard(page, projectId);++ // A mouse drag onto another column lifts the card as soon as it moves and asks to move it there.+ const card = page.locator("[data-ticket-column] button", { hasText: TITLE }).first();+ const from = await card.boundingBox();+ const to = await page.locator('[data-ticket-column="in_progress"]').boundingBox();+ await page.mouse.move(from.x + from.width / 2, from.y + from.height / 2);+ await page.mouse.down();+ // Near the column's top rather than its middle: a tall column can end below the viewport.+ await page.mouse.move(to.x + to.width / 2, to.y + Math.min(60, to.height / 2), { steps: 12 });+ await page.mouse.up();+ const question = page.getByRole("dialog", { name: "移动工单" });+ await expect(question).toBeVisible();+ const sentence = await cardText(question);+ expect(sentence).toContain(`将「${TITLE}」移到「进行中」?`);++ const writes = [];+ const pattern = await refuseWrite(page, ticketUrl, "POST", writes, "/move");+ await question.getByRole("button", { name: "确认", exact: true }).click();++ await expect(question.getByText(REFUSAL.message)).toBeVisible();+ await expect(page.getByRole("region", { name: "通知" })).not.toContainText(REFUSAL.message);+ expect(writes).toHaveLength(1);+ await expect(question).toBeVisible();+ expect(await cardText(question)).toBe(sentence);++ // Nothing was written: the card is still in its own column.+ expect((await stored()).status).toBe("proposed");+ await expect(+ page.locator('[data-ticket-column="proposed"]').getByText(TITLE, { exact: true }),+ ).toBeVisible();++ // The retry lands: the card goes and the card moves over.+ await page.unroute(pattern);+ await question.getByRole("button", { name: "确认", exact: true }).click();+ await expect(question).toHaveCount(0);+ await expect.poll(async () => (await stored()).status).toBe("in_progress");+ await expect(+ page.locator('[data-ticket-column="in_progress"]').getByText(TITLE, { exact: true }),+ ).toBeVisible();+});diff --git a/packages/web/src/features/company/ticket-dialog.tsx b/packages/web/src/features/company/ticket-dialog.tsxindex c8c71947..dd8fcc86 100644--- a/packages/web/src/features/company/ticket-dialog.tsx+++ b/packages/web/src/features/company/ticket-dialog.tsx@@ -181,6 +181,13 @@ function TicketDialog({const [moveTarget, setMoveTarget] = useState("");const [pendingMove, setPendingMove] = useState<OrgTicketStatus | null>(null);const [busy, setBusy] = useState(false);+ /**+ * The server's own words for a write one of this dialog's confirmations asked for and had+ * refused, drawn inside that card next to the button that retries it. One slot serves the three+ * cards: only one of them can be up at a time (each is raised from an idle footer, and a write in+ * flight leaves the others inert), and each is cleared of it before it is raised again.+ */+ const [refusal, setRefusal] = useState<string | null>(null);const names = new Map(employees.map((e) => [e.agentId, e.name]));const titles = new Map(tickets.map((t) => [t.ticketId, t.title]));/** Whether the board and roster on hand are this organization's, so the fields can read names. */@@ -202,6 +209,8 @@ function TicketDialog({setError(null);setEditing(null);setMoveTarget("");+ // The cards of the previous ticket go with it, and so does what the server said about them.+ setRefusal(null);}, [ticketId]);useEffect(() => {void load();@@ -234,7 +243,16 @@ function TicketDialog({};}, [projectId, orgId, ticketsVersion]);- const run = async (work: () => Promise<void>, done?: string) => {+ /**+ * A write this dialog asked for. `refuse` is how a confirmation reports a refused write back into+ * its own card — the callers that have a card to keep standing pass it; a write with no card+ * behind it (a progress note) falls back to the toast.+ */+ const run = async (+ work: () => Promise<void>,+ done?: string,+ refuse?: (reason: string) => void,+ ) => {setBusy(true);try {await work();@@ -242,7 +260,9 @@ function TicketDialog({await load();onChanged();} catch (e) {- toastError(apiErrorText(e));+ const reason = apiErrorText(e);+ if (refuse !== undefined) refuse(reason);+ else toastError(reason);} finally {setBusy(false);}@@ -297,17 +317,25 @@ function TicketDialog({setEditing(null);return;}+ // A new question, not the last one: the previous refusal is not its answer.+ setRefusal(null);setPendingSave(body);};const commitSave = () => {if (detail === null || pendingSave === null) return;const body = pendingSave;- setPendingSave(null);- void run(async () => {- await api.updateOrgTicket(projectId, orgId, detail.ticketId, body);- setEditing(null);- }, S.company.tickets.saved);+ void run(+ async () => {+ await api.updateOrgTicket(projectId, orgId, detail.ticketId, body);+ setEditing(null);+ // The card goes with its own save landing, never before: a refusal has to stay readable+ // next to the button that retries it.+ setPendingSave(null);+ },+ S.company.tickets.saved,+ setRefusal,+ );};const addProgress = () => {@@ -324,14 +352,33 @@ function TicketDialog({const commitMove = (reason: string) => {if (detail === null || pendingMove === null) return;const to = pendingMove;- setPendingMove(null);- void run(async () => {- await api.moveOrgTicket(projectId, orgId, detail.ticketId, {- status: to,- ...(moveNeedsReason(to) ? { reason: reason.trim() } : {}),- });- setMoveTarget("");- }, S.company.tickets.moved);+ void run(+ async () => {+ await api.moveOrgTicket(projectId, orgId, detail.ticketId, {+ status: to,+ ...(moveNeedsReason(to) ? { reason: reason.trim() } : {}),+ });+ setMoveTarget("");+ // The card goes with its own move landing, never before: a refusal has to stay readable+ // next to the button that retries it.+ setPendingMove(null);+ },+ S.company.tickets.moved,+ setRefusal,+ );+ };++ /** Lifting the block, once its confirmation is answered. */+ const commitUnblock = () => {+ if (detail === null) return;+ void run(+ async () => {+ await api.unblockOrgTicket(projectId, orgId, detail.ticketId);+ setConfirmUnblock(false);+ },+ undefined,+ setRefusal,+ );};const children = (detail?.children ?? []).map(@@ -893,7 +940,15 @@ function TicketDialog({{detail !== null && (<div className="flex shrink-0 flex-wrap items-center gap-2 border-t border-gray-200 px-4 py-3 dark:border-gray-800">{blocked ? (- <Button size="sm" disabled={busy} onClick={() => setConfirmUnblock(true)}>+ <Button+ size="sm"+ disabled={busy}+ onClick={() => {+ // A new question, not the last one: the previous refusal is not its answer.+ setRefusal(null);+ setConfirmUnblock(true);+ }}+ >{S.company.tickets.unblock}</Button>) : (@@ -923,7 +978,11 @@ function TicketDialog({disabled={busy || moveTarget === ""}onClick={() => {const to = TICKET_COLUMNS.find((s) => s === moveTarget);- if (to !== undefined) setPendingMove(to);+ if (to !== undefined) {+ // A new question, not the last one: the previous refusal is not its answer.+ setRefusal(null);+ setPendingMove(to);+ }}}>{S.company.tickets.move}@@ -940,6 +999,7 @@ function TicketDialog({busy={busy}onClose={() => (busy ? undefined : setPendingMove(null))}onConfirm={commitMove}+ {...(refusal !== null ? { refusal: S.common.refused(refusal) } : {})}/><ConfirmModalopen={pendingSave !== null}@@ -950,6 +1010,7 @@ function TicketDialog({busy={busy}onClose={() => (busy ? undefined : setPendingSave(null))}onConfirm={commitSave}+ {...(refusal !== null ? { refusal: S.common.refused(refusal) } : {})}><p className="text-sm text-gray-600 dark:text-gray-300">{S.company.tickets.saveConfirm(detail?.title ?? "")}@@ -963,13 +1024,8 @@ function TicketDialog({cancelLabel={S.common.cancel}busy={busy}onClose={() => (busy ? undefined : setConfirmUnblock(false))}- onConfirm={() => {- if (detail === null) return;- setConfirmUnblock(false);- void run(async () => {- await api.unblockOrgTicket(projectId, orgId, detail.ticketId);- });- }}+ onConfirm={commitUnblock}+ {...(refusal !== null ? { refusal: S.common.refused(refusal) } : {})}><p className="text-sm text-gray-600 dark:text-gray-300">{S.company.tickets.unblockConfirm(detail?.title ?? "")}@@ -1042,12 +1098,15 @@ export function MoveTicketConfirm({busy,onClose,onConfirm,+ refusal,}: {/** The move waiting for an answer, or null when none is. */move: { title: string; to: OrgTicketStatus } | null;busy: boolean;onClose: () => void;onConfirm: (reason: string) => void;+ /** The server's words for a refused move; absent (not empty) when nothing was refused. */+ refusal?: string;}) {const [reason, setReason] = useState("");// Emptied on the move itself, never on the object carrying it: the callers build that inline,@@ -1069,6 +1128,7 @@ export function MoveTicketConfirm({busy={busy}onClose={onClose}onConfirm={() => onConfirm(reason)}+ {...(refusal !== undefined ? { refusal } : {})}><div className="space-y-2"><p className="text-sm text-gray-600 dark:text-gray-300">diff --git a/packages/web/src/features/company/tickets-page.tsx b/packages/web/src/features/company/tickets-page.tsxindex 39374b97..4c9a5251 100644--- a/packages/web/src/features/company/tickets-page.tsx+++ b/packages/web/src/features/company/tickets-page.tsx@@ -119,6 +119,8 @@ export function TicketsPage() {const [blockedOnly, setBlockedOnly] = useState(params.get("blocked") === "1");const [query, setQuery] = useState("");const [move, setMove] = useState<{ ticket: OrgTicketItem; to: OrgTicketStatus } | null>(null);+ /** The server's own words for a move this board asked for and had refused, drawn in that card. */+ const [moveRefusal, setMoveRefusal] = useState<string | null>(null);const [createOpen, setCreateOpen] = useState(false);const [busy, setBusy] = useState(false);const highlightColumn = params.get("column");@@ -167,7 +169,11 @@ export function TicketsPage() {const openTicket = (ticketId: string) => company.openTicket(projectId, orgId, ticketId);const drag = useTicketBoardDrag({onOpen: (ticket) => openTicket(ticket.ticketId),- onDrop: (ticket, to) => setMove({ ticket, to }),+ onDrop: (ticket, to) => {+ // A new question, not the last one: the previous refusal is not its answer.+ setMoveRefusal(null);+ setMove({ ticket, to });+ },});const { lifted, dropOver } = drag;@@ -221,12 +227,15 @@ export function TicketsPage() {...(moveNeedsReason(move.to) ? { reason: reason.trim() } : {}),});toastSuccess(S.company.tickets.moved);+ // The card goes with its own move landing, never before: a refusal has to stay readable+ // next to the button that retries it.setMove(null);+ setMoveRefusal(null);// One signal for a ticket written here: this board, the open dialog and the// organization summaries all refetch off it.company.ticketsChanged();} catch (e) {- toastError(apiErrorText(e));+ setMoveRefusal(apiErrorText(e));} finally {setBusy(false);}@@ -513,6 +522,7 @@ export function TicketsPage() {busy={busy}onClose={() => (busy ? undefined : setMove(null))}onConfirm={(reason) => void confirmMove(reason)}+ {...(moveRefusal !== null ? { refusal: S.common.refused(moveRefusal) } : {})}/><CreateTicketDialog