Skip to content

Commit

Permalink
fix(stops): update stop IDs for redirecting
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Nov 30, 2023
1 parent 98a71e0 commit 813c538
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ defmodule SiteWeb.OldSiteRedirectController do
end
end

@doc """
Google Maps, and probably other places across the internet, often point
visitors to old links for stops. This will redirect them to the right page.
"""
def schedules_and_maps(conn, %{"path" => [_mode, "lines", "stations" | _], "stopId" => stop_id}) do
case Stops.Repo.old_id_to_gtfs_id(stop_id) do
nil -> permanent_redirect(conn, mode_path(conn, :index))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ defmodule SiteWeb.OldSiteRedirectControllerTest do
old_url = "/schedules_and_maps/rail/lines/stations/?stopId=19"

assert redirected_to(get(conn, old_url), :moved_permanently) =~
stop_path(SiteWeb.Endpoint, :show, "Beverly")
stop_path(SiteWeb.Endpoint, :show, "place-ER-0183")
end

test "Other rail routes redirected to commuter rail stops page", %{conn: conn} do
Expand Down
Loading

0 comments on commit 813c538

Please sign in to comment.