]> git.openstreetmap.org Git - rails.git/commitdiff
Clean up after creating nested relation resources
authorAnton Khorev <tony29@yandex.ru>
Sun, 2 Feb 2025 11:32:57 +0000 (14:32 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 8 Feb 2025 15:22:55 +0000 (18:22 +0300)
app/controllers/api/relations_controller.rb
test/controllers/api/relations_controller_test.rb

index ce52382e7cbf7cf2cc83a88c2ca4079510aa6335..3181a5df143ce00670463c36b2ed08524c7ce899 100644 (file)
@@ -122,23 +122,5 @@ module Api
         head :bad_request
       end
     end
         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
   end
 end
index e34dc616a48722b33deb66a948be3d02d78d5854..5e480b69c0b1d02584554a2ba43b9578f444f8c2 100644 (file)
@@ -1013,25 +1013,6 @@ module Api
 
     private
 
 
     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.
     ##
     # checks that the XML document and the string arguments have
     # members in the same order.