Show error toast on failed report resolution

This commit is contained in:
Jon Staab 2026-08-21 15:54:11 -07:00
parent 0e35cadebe
commit a28a4fd72a
2 changed files with 11 additions and 5 deletions

View file

@ -654,9 +654,6 @@ test("US-097 work through the action-items queue", async ({seed, as}) => {
await openSpaceMenu(admin) await openSpaceMenu(admin)
await expect(queueButton).toHaveText("Action Items (4)")
await expect(queueButton.locator(".bg-primary")).toHaveCount(1)
await queueButton.click() await queueButton.click()
const queue = dialog(admin, "Action Items") const queue = dialog(admin, "Action Items")
@ -681,6 +678,10 @@ test("US-097 work through the action-items queue", async ({seed, as}) => {
await expect(carolsRequest).toContainText("requested membership in #Vault") await expect(carolsRequest).toContainText("requested membership in #Vault")
await expect(bobsRequest).toContainText("requested membership in #Vault") await expect(bobsRequest).toContainText("requested membership in #Vault")
// The button summarizes what the queue holds, so it is checked against a known queue
await expect(queueButton).toHaveText("Action Items (4)")
await expect(queueButton.locator(".bg-primary")).toHaveCount(1)
await carolsRequest.getByRole("button", {name: "Accept"}).click() await carolsRequest.getByRole("button", {name: "Accept"}).click()
await expect(admin.getByRole("alert")).toContainText("Member has been added to the room!") await expect(admin.getByRole("alert")).toContainText("Member has been added to the room!")

View file

@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import {Report} from "@welshman/domain" import {Report} from "@welshman/domain"
import {publishToRelays} from "@welshman/app"
import {preventDefault} from "@lib/html" import {preventDefault} from "@lib/html"
import Spinner from "@lib/components/Spinner.svelte" import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
@ -37,9 +36,15 @@
.setReason(reason.toLowerCase()) .setReason(reason.toLowerCase())
.setContent(content) .setContent(content)
await command(eventWriter).then(publishToRelays([url])) const reportCommand = await command(eventWriter)
const error = await reportCommand.publishToRelays([url]).waitForError()
loading = false loading = false
if (error) {
return pushToast({theme: "error", message: error})
}
history.back() history.back()
return pushToast({message: "Your report has been sent!"}) return pushToast({message: "Your report has been sent!"})