({
values,
thread,
user,
})
| 51 | * forget it (logging any rejection) and return immediately. |
| 52 | */ |
| 53 | export const fileIssueSubmit: ModalSubmitHandler = async ({ |
| 54 | values, |
| 55 | thread, |
| 56 | user, |
| 57 | }) => { |
| 58 | const issue = issueFromValues(values); |
| 59 | if (!issue.title.trim()) { |
| 60 | return { errors: { title: "Give the issue a title." } }; |
| 61 | } |
| 62 | // No conversation context on the submission → nothing to post into; ack only. |
| 63 | if (!thread) return; |
| 64 | // Fire-and-forget: see the deadline note above — do NOT await this. |
| 65 | void thread |
| 66 | .runAgent({ |
| 67 | prompt: |
| 68 | `File a Linear issue now (this was already confirmed via the form):\n` + |
| 69 | `- Title: ${issue.title}\n- Type: ${issue.type}\n- Priority: ${issue.priority}\n` + |
| 70 | `- Description: ${issue.description || "(none)"}\n` + |
| 71 | `After filing, show the issue card.`, |
| 72 | context: senderContext(user, thread.platform), |
| 73 | }) |
| 74 | .catch((err) => { |
| 75 | console.error("[bot] file-issue modal run failed", err); |
| 76 | void thread |
| 77 | .post("Sorry — I couldn't file that issue. Please try again.") |
| 78 | .catch((postErr: unknown) => |
| 79 | console.error("[file-issue] failed to post error", postErr), |
| 80 | ); |
| 81 | }); |
| 82 | }; |
| 83 |
no test coverage detected