X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cf3cf5216fa3697ad2e3c060fced6a7bbb16f4a4..bf9dd8f350ca1b54afb79dda79506d980ccb5738:/app/controllers/api/ways_controller.rb?ds=sidebyside diff --git a/app/controllers/api/ways_controller.rb b/app/controllers/api/ways_controller.rb index 04c823ad2..3b58f208b 100644 --- a/app/controllers/api/ways_controller.rb +++ b/app/controllers/api/ways_controller.rb @@ -11,6 +11,8 @@ module Api before_action :check_api_readable, :except => [:create, :update, :delete] around_action :api_call_handle_error, :api_call_timeout + before_action :set_request_formats, :except => [:create, :update, :delete] + def create assert_method :put @@ -22,16 +24,15 @@ module Api end def show - way = Way.find(params[:id]) + @way = Way.find(params[:id]) - response.last_modified = way.timestamp - - if way.visible - @way = way + response.last_modified = @way.timestamp + if @way.visible # Render the result respond_to do |format| format.xml + format.json end else head :gone @@ -64,27 +65,24 @@ module Api end def full - way = Way.includes(:nodes => :node_tags).find(params[:id]) + @way = Way.includes(:nodes => :node_tags).find(params[:id]) - if way.visible + if @way.visible visible_nodes = {} - # changeset_cache = {} - # user_display_name_cache = {} @nodes = [] - way.nodes.uniq.each do |node| + @way.nodes.uniq.each do |node| if node.visible @nodes << node visible_nodes[node.id] = node end end - @way = way - # Render the result respond_to do |format| format.xml + format.json end else head :gone @@ -105,6 +103,7 @@ module Api # Render the result respond_to do |format| format.xml + format.json end end @@ -120,6 +119,7 @@ module Api # Render the result respond_to do |format| format.xml + format.json end end end