From 3a5c72986517ae11c8f225c1134bf869819a84e3 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 03:34:42 +0300 Subject: [PATCH] Don't link to self from element version pages --- app/views/browse/_common_details.html.erb | 2 +- test/controllers/old_nodes_controller_test.rb | 3 +++ test/controllers/old_relations_controller_test.rb | 3 +++ test/controllers/old_ways_controller_test.rb | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index fa8eeb3a5..7d3f8e829 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -1,6 +1,6 @@

<%= t "browse.version" %> - #<%= link_to common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %> + #<%= link_to_unless_current common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %>

diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index 80b8da946..68a6c1f3e 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -14,6 +14,9 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_nodes/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :count => 0 + end end def test_not_found diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 87ee50db4..2e791f227 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -14,6 +14,9 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_relations/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 + end end def test_visible_with_members diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 897bdba1f..022e4e820 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -14,6 +14,9 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_ways/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 1}']", :count => 0 + end end def test_visible_with_shared_nodes -- 2.39.5