From: Tom Hughes Date: Sun, 15 Sep 2024 18:30:22 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/5203' X-Git-Tag: live~607 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/33c0e95ebea3aeabae694ad5d9f0250dd11b56fb?hp=8d77891fd6796f32f665f7524e0ed8f098507f6d Merge remote-tracking branch 'upstream/pull/5203' --- diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 5aef4e7ca..9ea384811 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -92,7 +92,7 @@ module BrowseHelper end link_classes = ["page-link", { "px-1" => width > max_width_for_default_padding }] - tag.ul :class => "pagination pagination-sm mb-1 ms-auto" do + tag.ul :class => "pagination pagination-sm mb-2" do pagination_items(pages, {}).each do |body, page_or_class| linked = !(page_or_class.is_a? String) link = if linked diff --git a/app/views/changesets/_paging_nav.html.erb b/app/views/changesets/_paging_nav.html.erb index fbdf1d507..058738222 100644 --- a/app/views/changesets/_paging_nav.html.erb +++ b/app/views/changesets/_paging_nav.html.erb @@ -1,11 +1,9 @@ -
-

<%= type_and_paginated_count(type, pages) %>

- <% if pages.page_count > 1 %> - <%= sidebar_classic_pagination(pages, "#{type}_page") do |page| - { - :title => type_and_paginated_count(type, pages, page), - :data => { :turbo => "true" } - } - end %> - <% end %> -
+

<%= type_and_paginated_count(type, pages) %>

+<% if pages.page_count > 1 %> + <%= sidebar_classic_pagination(pages, "#{type}_page") do |page| + { + :title => type_and_paginated_count(type, pages, page), + :data => { :turbo => "true" } + } + end %> +<% end %> diff --git a/app/views/nodes/timeout.html.erb b/app/views/nodes/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/nodes/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/app/views/old_nodes/timeout.html.erb b/app/views/old_nodes/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/old_nodes/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/app/views/old_relations/timeout.html.erb b/app/views/old_relations/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/old_relations/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/app/views/old_ways/timeout.html.erb b/app/views/old_ways/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/old_ways/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/app/views/relations/timeout.html.erb b/app/views/relations/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/relations/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/app/views/ways/timeout.html.erb b/app/views/ways/timeout.html.erb new file mode 100644 index 000000000..61415c650 --- /dev/null +++ b/app/views/ways/timeout.html.erb @@ -0,0 +1,5 @@ +<% set_title(t("browse.timeout.title")) %> + +<%= render "sidebar_header", :title => t("browse.timeout.title") %> + +

<%= t ".sorry", :id => params[:id] %>

diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 225078a51..2ed3b2e91 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -123,6 +123,7 @@ ignore_unused: - 'geocoder.search_osm_nominatim.prefix.*' - 'javascripts.*' - 'doorkeeper.*' + - 'users.auth_failure.*' # OmniAuth provider callback error messages - 'activerecord.attributes.*' - 'activerecord.models.*' - 'activerecord.help.*' diff --git a/config/locales/en.yml b/config/locales/en.yml index faf9a8985..d114e0a88 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: @@ -1434,10 +1449,6 @@ en: level9: "Village Boundary" level10: "Suburb Boundary" level11: "Neighbourhood Boundary" - types: - cities: Cities - towns: Towns - places: Places results: no_results: "No results found" more_results: "More results" @@ -1672,7 +1683,6 @@ en: changeset_comment_notification: description: "OpenStreetMap Changeset #%{id}" hi: "Hi %{to_user}," - greeting: "Hi," commented: subject_own: "[OpenStreetMap] %{commenter} has commented on one of your changesets" subject_other: "[OpenStreetMap] %{commenter} has commented on a changeset you are interested in" @@ -2684,7 +2694,6 @@ en: contributor_terms_url: "https://wiki.osmfoundation.org/wiki/Licence/Contributor_Terms" contributor_terms: "contributor terms" tou: "terms of use" - external auth: "Third Party Authentication:" continue: Sign Up terms accepted: "Thanks for accepting the new contributor terms!" email_help: diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index 5bb08ea71..a29432723 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb @@ -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 diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index bb4dffdc6..abaf30d62 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -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 diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index a766f8b8d..f5de706cf 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -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 diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 6455343cf..fcc2281b8 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -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 diff --git a/test/controllers/relations_controller_test.rb b/test/controllers/relations_controller_test.rb index 926d95026..bdcbd2fd7 100644 --- a/test/controllers/relations_controller_test.rb +++ b/test/controllers/relations_controller_test.rb @@ -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 diff --git a/test/controllers/ways_controller_test.rb b/test/controllers/ways_controller_test.rb index e198f7cf6..995004cb4 100644 --- a/test/controllers/ways_controller_test.rb +++ b/test/controllers/ways_controller_test.rb @@ -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