From 5bcfb550ca19ca72f585cb2732a241a199195cb8 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 11 Jun 2024 13:29:50 -0500 Subject: [PATCH] only go back after send if it's a chat --- e2e/roundtrip.spec.ts | 5 +---- src/routes/Send.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/e2e/roundtrip.spec.ts b/e2e/roundtrip.spec.ts index 85aa699a..ca1eab9a 100644 --- a/e2e/roundtrip.spec.ts +++ b/e2e/roundtrip.spec.ts @@ -111,12 +111,9 @@ test("rountrip receive and send", async ({ page }) => { // Wait for an h1 to appear in the dom that says "Payment Sent" await page.waitForSelector("text=Payment Sent", { timeout: 30000 }); - // Click the "Nice" button + // Click the "Nice" button to go home await page.click("text=Nice"); - // Go home - await page.click("text=Home"); - // Click settings await visitSettings(page); diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 2056d86d..b153da74 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -708,7 +708,12 @@ export function Send() { onConfirm={() => { setSentDetails(undefined); const state = location.state as { previous?: string }; - if (state?.previous) { + // If we're coming from a chat, we want to go back to the chat + // Otherwise we want to go home + if ( + state?.previous && + state?.previous.includes("chat/") + ) { navigate(state?.previous); } else { navigate("/");