]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5214'
authorTom Hughes <tom@compton.nu>
Sun, 15 Sep 2024 18:08:31 +0000 (19:08 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 15 Sep 2024 18:08:31 +0000 (19:08 +0100)
13 files changed:
app/views/nodes/timeout.html.erb [new file with mode: 0644]
app/views/old_nodes/timeout.html.erb [new file with mode: 0644]
app/views/old_relations/timeout.html.erb [new file with mode: 0644]
app/views/old_ways/timeout.html.erb [new file with mode: 0644]
app/views/relations/timeout.html.erb [new file with mode: 0644]
app/views/ways/timeout.html.erb [new file with mode: 0644]
config/locales/en.yml
test/controllers/nodes_controller_test.rb
test/controllers/old_nodes_controller_test.rb
test/controllers/old_relations_controller_test.rb
test/controllers/old_ways_controller_test.rb
test/controllers/relations_controller_test.rb
test/controllers/ways_controller_test.rb

diff --git a/app/views/nodes/timeout.html.erb b/app/views/nodes/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
diff --git a/app/views/old_nodes/timeout.html.erb b/app/views/old_nodes/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
diff --git a/app/views/old_relations/timeout.html.erb b/app/views/old_relations/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
diff --git a/app/views/old_ways/timeout.html.erb b/app/views/old_ways/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
diff --git a/app/views/relations/timeout.html.erb b/app/views/relations/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
diff --git a/app/views/ways/timeout.html.erb b/app/views/ways/timeout.html.erb
new file mode 100644 (file)
index 0000000..61415c6
--- /dev/null
@@ -0,0 +1,5 @@
+<% set_title(t("browse.timeout.title")) %>
+
+<%= render "sidebar_header", :title => t("browse.timeout.title") %>
+
+<p><%= t ".sorry", :id => params[:id] %></p>
index faf9a89852325c8643c866371f36327501338e9e..06a60f977e03506df919c7ce64b266fe9c01acd3 100644 (file)
@@ -403,15 +403,30 @@ en:
       introduction: "Click on the map to find nearby features."
       nearby: "Nearby features"
       enclosing: "Enclosing features"
+  nodes:
+    timeout:
+      sorry: "Sorry, the data for the node with the id %{id}, took too long to retrieve."
   old_nodes:
     not_found:
       sorry: "Sorry, node #%{id} version %{version} could not be found."
+    timeout:
+      sorry: "Sorry, the history of the node with the id %{id}, took too long to retrieve."
+  ways:
+    timeout:
+      sorry: "Sorry, the data for the way with the id %{id}, took too long to retrieve."
   old_ways:
     not_found:
       sorry: "Sorry, way #%{id} version %{version} could not be found."
+    timeout:
+      sorry: "Sorry, the history of the way with the id %{id}, took too long to retrieve."
+  relations:
+    timeout:
+      sorry: "Sorry, the data for the relation with the id %{id}, took too long to retrieve."
   old_relations:
     not_found:
       sorry: "Sorry, relation #%{id} version %{version} could not be found."
+    timeout:
+      sorry: "Sorry, the history of the relation with the id %{id}, took too long to retrieve."
   changeset_comments:
     feeds:
       comment:
index 5bb08ea7104ba3ad21e531e1a9901ccb8a47a2ed..a294327231d78ca0b54b5e5f338ae305f27221d6 100644 (file)
@@ -90,4 +90,15 @@ class NodesControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a", :text => "View History", :count => 1
     assert_select ".secondary-actions a", :text => "View Unredacted History", :count => 1
   end
+
+  def test_show_timeout
+    node = create(:node)
+    with_settings(:web_timeout => -1) do
+      get node_path(node)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the node with the id #{node.id}")}/
+  end
 end
index bb4dffdc6e74636fd8c118e9bcc8207ceb7c775a..abaf30d62e68563e5f694e0a015b7e57668f77b4 100644 (file)
@@ -218,6 +218,17 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select "#sidebar_content", /node #0 version 0 could not be found/
   end
 
+  def test_show_timeout
+    node = create(:node, :with_history)
+    with_settings(:web_timeout => -1) do
+      get old_node_path(node, 1)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the node with the id #{node.id}")}/
+  end
+
   private
 
   def create_redacted_node
index a766f8b8db113178edf13a4504c8f8a622d6f646..f5de706cf59e92220e4ec5c2348e6dd9e06c7a9c 100644 (file)
@@ -177,6 +177,17 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select "#sidebar_content", /relation #0 version 0 could not be found/
   end
 
+  def test_show_timeout
+    relation = create(:relation, :with_history)
+    with_settings(:web_timeout => -1) do
+      get old_relation_path(relation, 1)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the relation with the id #{relation.id}")}/
+  end
+
   private
 
   def create_redacted_relation
index 6455343cfa63af9b1e4c43cb28bab6b9bbb021a6..fcc2281b85753cec329c579cf81366a76a171fd2 100644 (file)
@@ -182,6 +182,17 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select "#sidebar_content", /way #0 version 0 could not be found/
   end
 
+  def test_show_timeout
+    way = create(:way, :with_history)
+    with_settings(:web_timeout => -1) do
+      get old_way_path(way, 1)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the way with the id #{way.id}")}/
+  end
+
   private
 
   def create_redacted_way
index 926d9502638c1650b46ae44182e6e723b045e933..bdcbd2fd7bf386df6d0e49887761394808fbff1f 100644 (file)
@@ -36,4 +36,15 @@ class RelationsControllerTest < ActionDispatch::IntegrationTest
     sidebar_browse_check :relation_path, member.id, "browse/feature"
     assert_select "a[href='#{relation_path relation}']", :count => 1
   end
+
+  def test_show_timeout
+    relation = create(:relation)
+    with_settings(:web_timeout => -1) do
+      get relation_path(relation)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the relation with the id #{relation.id}")}/
+  end
 end
index e198f7cf6091f08af424b110955c86e6420d1739..995004cb4179236a95c8998263b90e872ae9366b 100644 (file)
@@ -36,4 +36,15 @@ class WaysControllerTest < ActionDispatch::IntegrationTest
     sidebar_browse_check :way_path, member.id, "browse/feature"
     assert_select "a[href='#{relation_path relation}']", :count => 1
   end
+
+  def test_show_timeout
+    way = create(:way)
+    with_settings(:web_timeout => -1) do
+      get way_path(way)
+    end
+    assert_response :error
+    assert_template :layout => "map"
+    assert_dom "h2", "Timeout Error"
+    assert_dom "p", /#{Regexp.quote("the way with the id #{way.id}")}/
+  end
 end