X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/673b58f96f3acfd0281c62a2a7f080825b6fb28b..70cca71f3802519eac1fabaeb3ee1cc9f35f5cb7:/app/controllers/amf_controller.rb?ds=inline diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 9f909ea10..07e7669b1 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -110,17 +110,17 @@ class AmfController < ApplicationController def amf_handle_error(call, rootobj, rootid) yield rescue OSM::APIAlreadyDeletedError => ex - return [-4, ex.object, ex.object_id] + [-4, ex.object, ex.object_id] rescue OSM::APIVersionMismatchError => ex - return [-3, [rootobj, rootid], [ex.type.downcase, ex.id, ex.latest]] + [-3, [rootobj, rootid], [ex.type.downcase, ex.id, ex.latest]] rescue OSM::APIUserChangesetMismatchError => ex - return [-2, ex.to_s] + [-2, ex.to_s] rescue OSM::APIBadBoundingBox => ex - return [-2, "Sorry - I can't get the map for that area. The server said: #{ex}"] + [-2, "Sorry - I can't get the map for that area. The server said: #{ex}"] rescue OSM::APIError => ex - return [-1, ex.to_s] + [-1, ex.to_s] rescue StandardError => ex - return [-2, "An unusual error happened (in #{call}). The server said: #{ex}"] + [-2, "An unusual error happened (in #{call}). The server said: #{ex}"] end def amf_handle_error_with_timeout(call, rootobj, rootid) @@ -437,9 +437,9 @@ class AmfController < ApplicationController revdates.collect! { |d| [(d + 1).strftime("%d %b %Y, %H:%M:%S")] + revusers[d.to_i] } revdates.uniq! - return ["way", wayid, revdates] + ["way", wayid, revdates] rescue ActiveRecord::RecordNotFound - return ["way", wayid, []] + ["way", wayid, []] end # Find history of a node. Returns 'node', id, and an array of previous versions as above. @@ -448,9 +448,9 @@ class AmfController < ApplicationController history = Node.find(nodeid).old_nodes.unredacted.reverse.collect do |old_node| [(old_node.timestamp + 1).strftime("%d %b %Y, %H:%M:%S")] + change_user(old_node) end - return ["node", nodeid, history] + ["node", nodeid, history] rescue ActiveRecord::RecordNotFound - return ["node", nodeid, []] + ["node", nodeid, []] end def change_user(obj) @@ -672,7 +672,7 @@ class AmfController < ApplicationController # -- Save revised way pointlist.collect! do |a| - renumberednodes[a] ? renumberednodes[a] : a + renumberednodes[a] || a end new_way = Way.new new_way.tags = attributes @@ -865,7 +865,7 @@ class AmfController < ApplicationController end def getlocales - @locales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") }) + @getlocales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") }) end ## @@ -938,7 +938,7 @@ class AmfController < ApplicationController INNER JOIN current_relation_members crm ON crm.id=cr.id INNER JOIN current_nodes cn ON crm.member_id=cn.id AND crm.member_type='Node' WHERE #{OSM.sql_for_area(bbox, 'cn.')} - SQL + SQL unless way_ids.empty? sql += <<-SQL UNION @@ -947,7 +947,7 @@ class AmfController < ApplicationController INNER JOIN current_relation_members crm ON crm.id=cr.id WHERE crm.member_type='Way' AND crm.member_id IN (#{way_ids.join(',')}) - SQL + SQL end ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["relid"].to_i, a["version"].to_i] } end