+ new_segment = Segment.from_xml(request.raw_post)
+
+ if new_segment and new_segment.id == segment.id
+ if new_segment.node_a == new_segment.node_b
+ render :nothing => true, :status => :expectation_failed
+ elsif !new_segment.preconditions_ok?
+ render :nothing => true, :status => :precondition_failed
+ else
+ segment.user_id = @user.id
+ segment.node_a = new_segment.node_a
+ segment.node_b = new_segment.node_b
+ segment.tags = new_segment.tags
+ segment.visible = new_segment.visible
+ segment.save_with_history!
+
+ render :nothing => true
+ end
+ else
+ render :nothing => true, :status => :bad_request
+ end