X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c38e4bf4a0f76550300386bbabf4bdda943e56c1..cdb9d2527a8524eea02856c27fff10ad5c138344:/app/controllers/segment_controller.rb?ds=inline diff --git a/app/controllers/segment_controller.rb b/app/controllers/segment_controller.rb index 7e77609f3..76cb5cebb 100644 --- a/app/controllers/segment_controller.rb +++ b/app/controllers/segment_controller.rb @@ -10,18 +10,17 @@ class SegmentController < ApplicationController segment = Segment.from_xml(request.raw_post, true) if segment - segment.user_id = @user.id - a = Node.find(segment.node_a.to_i) - b = Node.find(segment.node_b.to_i) + segment.from_node = Node.find(segment.node_a.to_i) + segment.to_node = Node.find(segment.node_b.to_i) - unless a and a.visible and b and b.visible - render :nothing => true, :status => 400 + unless segment.preconditions_ok? # are the nodes visible? + render :nothing => true, :status => 412 end if segment.save_with_history - render :text => segment.id + render :text => segment.id.to_s else render :nothing => true, :status => 500 end @@ -86,7 +85,7 @@ class SegmentController < ApplicationController ids = params['segments'].split(',').collect {|s| s.to_i } if ids.length > 0 segmentlist = Segment.find(ids) - doc = get_xml_doc + doc = OSM::API.get_xml_doc segmentlist.each do |segment| doc.root << segment.to_xml_node end