From f27e16af1d6cfaf8e5b31d17b2fa5eb72e35a55d Mon Sep 17 00:00:00 2001 From: Owen Rees Date: Thu, 12 Nov 2026 22:58:34 +0100 Subject: [PATCH] Allow bulk importer through prelaunch gate (#159) The new EndgameLive.Import view was missing from the prelaunch allowlist, so PRELAUNCH=true redirected it to the home page. --- lib/chesstrainer_web/user_auth.ex | 1 + test/chesstrainer_web/plugs/prelaunch_test.exs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/chesstrainer_web/user_auth.ex b/lib/chesstrainer_web/user_auth.ex index d8bbcf3..5e50af3 100644 --- a/lib/chesstrainer_web/user_auth.ex +++ b/lib/chesstrainer_web/user_auth.ex @@ -219,6 +219,7 @@ defmodule ChesstrainerWeb.UserAuth do ChesstrainerWeb.EndgameLive.Index, ChesstrainerWeb.EndgameLive.Form, ChesstrainerWeb.EndgameLive.Show, + ChesstrainerWeb.EndgameLive.Import, ChesstrainerWeb.Admin.ThemeLive.Index, ChesstrainerWeb.Admin.ThemeLive.Form, ChesstrainerWeb.Admin.UserLive.Index, diff --git a/test/chesstrainer_web/plugs/prelaunch_test.exs b/test/chesstrainer_web/plugs/prelaunch_test.exs index 43acc04..107835a 100644 --- a/test/chesstrainer_web/plugs/prelaunch_test.exs +++ b/test/chesstrainer_web/plugs/prelaunch_test.exs @@ -62,6 +62,18 @@ defmodule ChesstrainerWeb.Plugs.PrelaunchTest do assert get_resp_header(conn, "x-robots-tag") == ["noindex, nofollow"] end + test "allows the admin bulk import page", %{conn: conn} do + admin = + user_fixture() + |> Ecto.Changeset.change(role: :admin) + |> Repo.update!() + + conn = log_in_user(conn, admin) + + assert {:ok, _view, html} = live(conn, ~p"/admin/endgames/import") + assert html =~ "Import endgames" + end + test "redirects registration and unknown pages", %{conn: conn} do assert conn |> get(~p"/users/register") |> redirected_to() == "/" assert conn |> get("/definitely-not-a-page") |> redirected_to() == "/"