Make api old element show paths resourceful

This commit is contained in:
Anton Khorev 2025-02-08 20:29:15 +03:00
parent 29323be33b
commit f2ed3c1935
12 changed files with 151 additions and 117 deletions

View file

@ -64,7 +64,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
end
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
@ -79,7 +79,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
end
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1
@ -91,7 +91,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0
end
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 2}']", :count => 1
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 2}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1
@ -116,7 +116,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 1}']", :count => 0
end
test "show unrevealed redacted versions to regular users" do
@ -130,7 +130,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 1}']", :count => 0
end
test "show unrevealed redacted versions to moderators" do
@ -144,7 +144,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
assert_select ".secondary-actions a[href='#{api_relation_version_path relation, 1}']", :count => 0
end
test "don't reveal redacted versions to anonymous users" do