From: Anton Khorev Date: Sun, 2 Feb 2025 11:32:57 +0000 (+0300) Subject: Clean up after creating nested relation resources X-Git-Tag: live~92^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/18b8e0cb34884f5a1f890e9a82fa989d42d21d1a?ds=sidebyside;hp=--cc Clean up after creating nested relation resources --- 18b8e0cb34884f5a1f890e9a82fa989d42d21d1a diff --git a/app/controllers/api/relations_controller.rb b/app/controllers/api/relations_controller.rb index ce52382e7..3181a5df1 100644 --- a/app/controllers/api/relations_controller.rb +++ b/app/controllers/api/relations_controller.rb @@ -122,23 +122,5 @@ module Api head :bad_request end end - - private - - def relations_for_object(objtype) - relationids = RelationMember.where(:member_type => objtype, :member_id => params[:id]).collect(&:relation_id).uniq - - @relations = [] - - Relation.find(relationids).each do |relation| - @relations << relation if relation.visible - end - - # Render the result - respond_to do |format| - format.xml - format.json - end - end end end diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index e34dc616a..5e480b69c 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -1013,25 +1013,6 @@ module Api private - def check_relations_for_element(path, type, id, expected_relations) - # check the "relations for relation" mode - get path - assert_response :success - - # count one osm element - assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1 - - # we should have only the expected number of relations - assert_select "osm>relation", expected_relations.size - - # and each of them should contain the element we originally searched for - expected_relations.each do |relation| - # The relation should appear once, but the element could appear multiple times - assert_select "osm>relation[id='#{relation.id}']", 1 - assert_select "osm>relation[id='#{relation.id}']>member[type='#{type}'][ref='#{id}']" - end - end - ## # checks that the XML document and the string arguments have # members in the same order.