Skip to content

Commit d507d2a

Browse files
committed
AO3-6911: prefer lazy loaded locale, fix route
1 parent 3f2d882 commit d507d2a

File tree

8 files changed

+16
-9
lines changed

8 files changed

+16
-9
lines changed

app/controllers/application_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def raise_not_found
2828
rescue_from Rack::Timeout::RequestTimeoutException, with: :raise_timeout
2929

3030
def raise_timeout
31-
redirect_to "/timeout"
31+
redirect_to timeout_error_path
3232
end
3333

3434
helper :all # include all helpers, all the time

app/controllers/errors_controller.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ class ErrorsController < ApplicationController
66
end
77

88
def auth_error
9-
@page_subtitle = "Auth Error"
9+
@page_subtitle = t(".subtitle")
1010
end
1111

1212
def timeout_error
13-
@page_subtitle = "Timeout Error"
13+
@page_subtitle = t(".subtitle")
14+
render "timeout_error", status: 200, formats: :html
1415
end
1516
end

app/views/errors/timeout.html.erb

-3
This file was deleted.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h2 class="heading"><%= t(".title") %></h2>
2+
<h3 class="heading"><%= t(".subtitle") %></h3>
3+
<p><%= t(".html", contact_support_link: link_to(t(".contact_support_link"), new_feedback_report_path)) %></p>

config/locales/controllers/en.yml

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ en:
9090
error: Sorry, that comment could not be unhidden.
9191
permission_denied: Sorry, you don't have permission to unhide that comment.
9292
success: Comment successfully unhidden!
93+
errors:
94+
timeout_error:
95+
subtitle: "Timeout Error"
96+
auth_error:
97+
subtitle: "Authentication Error"
9398
external_works:
9499
update:
95100
successfully_updated: External work was successfully updated.

config/locales/views/en.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,11 @@ en:
612612
revealed_html: A translation of %{work_link} by %{creator_link}
613613
unrevealed: A translation of a work in an unrevealed collection
614614
errors:
615-
timeout:
615+
timeout_error:
616616
title: Timeout
617617
subtitle: The page was responding too slowly. Please try again after a few minutes.
618618
html: If you still get this error after a few tries, please %{contact_support_link}.
619+
contact_support_link: contact Support
619620
feedbacks:
620621
new:
621622
abuse:

config/routes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
get '/422', to: 'errors#422'
5454
get '/500', to: 'errors#500'
5555
get '/auth_error', to: 'errors#auth_error'
56-
get "/timeout", to: "errors#timeout"
56+
get "/timeout_error", to: "errors#timeout_error"
5757

5858
#### DOWNLOADS ####
5959

spec/controllers/errors_controller_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
end
3030
end
3131

32-
describe "auth_error" do
32+
describe "GET #auth_error" do
3333
it "returns an HTML auth error page" do
3434
get :auth_error
3535
expect(response.status).to eq(200)

0 commit comments

Comments
 (0)