Merge remote-tracking branch 'upstream/pull/5475'

This commit is contained in:
Tom Hughes 2025-01-06 19:06:32 +00:00
commit e6b0afc6c8
19 changed files with 56 additions and 40 deletions

View file

@ -10,6 +10,6 @@ class OldNodesController < OldElementsController
@type = "node" @type = "node"
@feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]]) @feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found render "browse/not_found", :status => :not_found
end end
end end

View file

@ -10,6 +10,6 @@ class OldRelationsController < OldElementsController
@type = "relation" @type = "relation"
@feature = OldRelation.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member).find([params[:id], params[:version]]) @feature = OldRelation.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member).find([params[:id], params[:version]])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found render "browse/not_found", :status => :not_found
end end
end end

View file

@ -10,6 +10,6 @@ class OldWaysController < OldElementsController
@type = "way" @type = "way"
@feature = OldWay.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }).find([params[:id], params[:version]]) @feature = OldWay.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }).find([params[:id], params[:version]])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found render "browse/not_found", :status => :not_found
end end
end end

View file

@ -2,6 +2,4 @@
<%= render "sidebar_header", :title => t(".title") %> <%= render "sidebar_header", :title => t(".title") %>
<div> <%= render "not_found_message" %>
<p><%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %>
</div>

View file

@ -0,0 +1,3 @@
<div>
<p><%= t ".sorry", :id => params[:id] %></p>
</div>

View file

@ -0,0 +1,3 @@
<div>
<p><%= t ".sorry", :id => params[:id] %></p>
</div>

View file

@ -0,0 +1,3 @@
<div>
<p><%= t ".sorry", :id => params[:id] %></p>
</div>

View file

@ -0,0 +1,7 @@
<div>
<% if params[:version] %>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
<% else %>
<p><%= t "nodes.not_found_message.sorry", :id => params[:id] %></p>
<% end %>
</div>

View file

@ -1,7 +0,0 @@
<% set_title(t("browse.not_found.title")) %>
<%= render "sidebar_header", :title => t("browse.not_found.title") %>
<div>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
</div>

View file

@ -0,0 +1,7 @@
<div>
<% if params[:version] %>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
<% else %>
<p><%= t "relations.not_found_message.sorry", :id => params[:id] %></p>
<% end %>
</div>

View file

@ -1,7 +0,0 @@
<% set_title(t("browse.not_found.title")) %>
<%= render "sidebar_header", :title => t("browse.not_found.title") %>
<div>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
</div>

View file

@ -0,0 +1,7 @@
<div>
<% if params[:version] %>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
<% else %>
<p><%= t "ways.not_found_message.sorry", :id => params[:id] %></p>
<% end %>
</div>

View file

@ -1,7 +0,0 @@
<% set_title(t("browse.not_found.title")) %>
<%= render "sidebar_header", :title => t("browse.not_found.title") %>
<div>
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
</div>

View file

@ -0,0 +1,3 @@
<div>
<p><%= t ".sorry", :id => params[:id] %></p>
</div>

View file

@ -0,0 +1,3 @@
<div>
<p><%= t ".sorry", :id => params[:id] %></p>
</div>

View file

@ -354,13 +354,6 @@ en:
entry_role_html: "%{relation_name} (as %{relation_role})" entry_role_html: "%{relation_name} (as %{relation_role})"
not_found: not_found:
title: Not Found title: Not Found
sorry: "Sorry, %{type} #%{id} could not be found."
type:
node: node
way: way
relation: relation
changeset: changeset
note: note
timeout: timeout:
title: Timeout Error title: Timeout Error
sorry: "Sorry, the data for the %{type} with the id %{id} took too long to retrieve." sorry: "Sorry, the data for the %{type} with the id %{id} took too long to retrieve."
@ -409,26 +402,32 @@ en:
view_redacted_data: "View Redacted Data" view_redacted_data: "View Redacted Data"
view_redaction_message: "View Redaction Message" view_redaction_message: "View Redaction Message"
nodes: nodes:
not_found_message:
sorry: "Sorry, node #%{id} could not be found."
timeout: timeout:
sorry: "Sorry, the data for the node with the id %{id} took too long to retrieve." sorry: "Sorry, the data for the node with the id %{id} took too long to retrieve."
old_nodes: old_nodes:
not_found: not_found_message:
sorry: "Sorry, node #%{id} version %{version} could not be found." sorry: "Sorry, node #%{id} version %{version} could not be found."
timeout: timeout:
sorry: "Sorry, the history of the node with the id %{id} took too long to retrieve." sorry: "Sorry, the history of the node with the id %{id} took too long to retrieve."
ways: ways:
not_found_message:
sorry: "Sorry, way #%{id} could not be found."
timeout: timeout:
sorry: "Sorry, the data for the way with the id %{id} took too long to retrieve." sorry: "Sorry, the data for the way with the id %{id} took too long to retrieve."
old_ways: old_ways:
not_found: not_found_message:
sorry: "Sorry, way #%{id} version %{version} could not be found." sorry: "Sorry, way #%{id} version %{version} could not be found."
timeout: timeout:
sorry: "Sorry, the history of the way with the id %{id} took too long to retrieve." sorry: "Sorry, the history of the way with the id %{id} took too long to retrieve."
relations: relations:
not_found_message:
sorry: "Sorry, relation #%{id} could not be found."
timeout: timeout:
sorry: "Sorry, the data for the relation with the id %{id} took too long to retrieve." sorry: "Sorry, the data for the relation with the id %{id} took too long to retrieve."
old_relations: old_relations:
not_found: not_found_message:
sorry: "Sorry, relation #%{id} version %{version} could not be found." sorry: "Sorry, relation #%{id} version %{version} could not be found."
timeout: timeout:
sorry: "Sorry, the history of the relation with the id %{id} took too long to retrieve." sorry: "Sorry, the history of the relation with the id %{id} took too long to retrieve."
@ -504,6 +503,8 @@ en:
ways_paginated: "Ways (%{x}-%{y} of %{count})" ways_paginated: "Ways (%{x}-%{y} of %{count})"
relations: "Relations (%{count})" relations: "Relations (%{count})"
relations_paginated: "Relations (%{x}-%{y} of %{count})" relations_paginated: "Relations (%{x}-%{y} of %{count})"
not_found_message:
sorry: "Sorry, changeset #%{id} could not be found."
timeout: timeout:
sorry: "Sorry, the list of changesets you requested took too long to retrieve." sorry: "Sorry, the list of changesets you requested took too long to retrieve."
dashboards: dashboards:
@ -3096,6 +3097,8 @@ en:
showing_page: "Page %{page}" showing_page: "Page %{page}"
next: "Next" next: "Next"
previous: "Previous" previous: "Previous"
not_found_message:
sorry: "Sorry, note #%{id} could not be found."
javascripts: javascripts:
close: Close close: Close
share: share:

View file

@ -213,7 +213,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
def test_not_found def test_not_found
get old_node_path(0, 0) get old_node_path(0, 0)
assert_response :not_found assert_response :not_found
assert_template "old_nodes/not_found" assert_template "browse/not_found"
assert_template :layout => "map" assert_template :layout => "map"
assert_select "#sidebar_content", /node #0 version 0 could not be found/ assert_select "#sidebar_content", /node #0 version 0 could not be found/
end end

View file

@ -172,7 +172,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
def test_not_found def test_not_found
get old_relation_path(0, 0) get old_relation_path(0, 0)
assert_response :not_found assert_response :not_found
assert_template "old_relations/not_found" assert_template "browse/not_found"
assert_template :layout => "map" assert_template :layout => "map"
assert_select "#sidebar_content", /relation #0 version 0 could not be found/ assert_select "#sidebar_content", /relation #0 version 0 could not be found/
end end

View file

@ -177,7 +177,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
def test_not_found def test_not_found
get old_way_path(0, 0) get old_way_path(0, 0)
assert_response :not_found assert_response :not_found
assert_template "old_ways/not_found" assert_template "browse/not_found"
assert_template :layout => "map" assert_template :layout => "map"
assert_select "#sidebar_content", /way #0 version 0 could not be found/ assert_select "#sidebar_content", /way #0 version 0 could not be found/
end end