Skip to content

Commit

Permalink
finish /u redirect from 9fff6ae with 301s
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Jan 2, 2024
1 parent ac3b88c commit 4fd296e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
14 changes: 7 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@
:as => "user_enable_invite"

# 2023-07 redirect /u to /~username and /users (for tree)
get "/u", to: redirect("/users", status: 302)
get "/u/:username", to: redirect("/~%{username}", status: 302)
get "/u", to: redirect("/users", status: 301)
get "/u/:username", to: redirect("/~%{username}", status: 301)
# we don't do /@alice but easy mistake with comments autolinking @alice
get "/@:username", to: redirect("/~%{username}", status: 302)
get "/u/:username/standing", to: redirect("~%{username}/standing", status: 302)
get "/newest/:user", to: redirect("~%{user}/stories", status: 302)
get "/newest/:user(/page/:page)", to: redirect("~%{user}/stories/page/%{page}", status: 302)
get "/threads/:user", to: redirect("~%{user}/threads", status: 302)
get "/@:username", to: redirect("/~%{username}", status: 301)
get "/u/:username/standing", to: redirect("~%{username}/standing", status: 301)
get "/newest/:user", to: redirect("~%{user}/stories", status: 301)
get "/newest/:user(/page/:page)", to: redirect("~%{user}/stories/page/%{page}", status: 301)
get "/threads/:user", to: redirect("~%{user}/threads", status: 301)

get "/avatars/:username_size.png" => "avatars#show"
post "/avatars/expire" => "avatars#expire"
Expand Down
9 changes: 0 additions & 9 deletions spec/routing/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,4 @@
it "threads" do
expect(get("/threads/alice")).to redirect_to("/~alice/threads")
end

# 2023-07: I'm deploying with 302 redirects so I don't have to worry about 301s getting
# indefinitely cached in case of error, but after some time to build confidence, it's appropriate
# to 301. I'm putting a time bomb test in here to remind me to finalize.
it "is temporarily temporary" do
expect(get("/u/alice")).to eq(302)

expect(Time.zone.today).to be_before(Date.new(2024, 1, 1))
end
end

0 comments on commit 4fd296e

Please sign in to comment.