v4: signing in comes back to the page that asked for it — a guest on a signed-in page, the dump editor, /notifications, /community, /settings or /manage, went to /login and, once signed in, to /, so a digest's link opened signed out lost its way; and since the redirect pushed, Back led to it again. RestrictedLoggedIn now replaces the page with /login?next=<the page>, as /authorize already did. A guest on a feed's "follow" tab, which only a link leads to, is sent there the same way, rather than shown the default tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-10-09 22:05:39 +00:00
parent 683944ebe2
commit 53ceb6bcbc
4 changed files with 30 additions and 20 deletions

View File

@@ -249,10 +249,10 @@ describe("Index feeds", () => {
.toBeInTheDocument();
});
test("a guest on the follow tab gets the default feed, not a blank page", async () => {
test("a guest on the follow tab is sent to sign in, and back", () => {
route("GET /api/dumps", () => page([older]));
setup("/follow");
await screen.findByText("Old but loved");
setup("/music/follow");
expect(currentPath()).toBe("/login?next=%2Fmusic%2Ffollow");
});
test("the Android share sheet opens the new-dump form with the link", async () => {

View File

@@ -3,21 +3,22 @@ import { screen } from "@testing-library/react";
import { Route } from "react-router";
import { RestrictedLoggedIn } from "../../pages/RestrictedLoggedIn.tsx";
import { makeSession } from "../fixtures.ts";
import { renderWithContexts } from "../render.tsx";
import { currentPath, renderWithContexts } from "../render.tsx";
describe("RestrictedLoggedIn", () => {
test("sends guests to login", () => {
test("sends guests to login, which comes back to the page", () => {
renderWithContexts(
<RestrictedLoggedIn>
<p>secret</p>
</RestrictedLoggedIn>,
{
route: "/notifications",
path: "/notifications",
route: "/community/monthly?x=1",
path: "/community/monthly",
extraRoutes: <Route path="/login" element={<p>login page</p>} />,
},
);
expect(screen.getByText("login page")).toBeInTheDocument();
expect(currentPath()).toBe("/login?next=%2Fcommunity%2Fmonthly%3Fx%3D1");
});
test("lets members through", () => {