( host: SlashCommandHost, goalId: string, )
| 269 | } |
| 270 | |
| 271 | async function showGoalQueueEditDialog( |
| 272 | host: SlashCommandHost, |
| 273 | goalId: string, |
| 274 | ): Promise<void> { |
| 275 | let snapshot: GoalQueueSnapshot; |
| 276 | try { |
| 277 | snapshot = await readGoalQueue(host.requireSession()); |
| 278 | } catch (error) { |
| 279 | host.showError(`Failed to load upcoming goals: ${formatErrorMessage(error)}`); |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | const goal = snapshot.goals.find((item) => item.id === goalId); |
| 284 | if (goal === undefined) { |
| 285 | host.showStatus('Queued goal no longer exists.'); |
| 286 | await showGoalQueueManager(host); |
| 287 | return; |
| 288 | } |
| 289 | |
| 290 | host.mountEditorReplacement( |
| 291 | new GoalQueueEditDialogComponent({ |
| 292 | goal, |
| 293 | onDone: (result) => { |
| 294 | void handleGoalQueueEditResult(host, result).catch((error: unknown) => { |
| 295 | host.showError(`Failed to update upcoming goal: ${formatErrorMessage(error)}`); |
| 296 | }); |
| 297 | }, |
| 298 | }), |
| 299 | ); |
| 300 | } |
| 301 | |
| 302 | async function handleGoalQueueEditResult( |
| 303 | host: SlashCommandHost, |
no test coverage detected