X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/945ff7911ca51dc250ffaba71f62821b5c0c0a95..4cd2d22788cbc8acf411c9f9436eee85a4590c5f:/app/controllers/changeset_controller.rb diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 89ba5d131..da066a73a 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -83,7 +83,7 @@ class ChangesetController < ApplicationController # the request is in pseudo-osm format... this is kind-of an # abuse, maybe should change to some other format? - doc = XML::Parser.string(request.raw_post).parse + doc = XML::Parser.string(request.raw_post, :options => XML::Parser::Options::NOERROR).parse doc.find("//osm/node").each do |n| lon << n["lon"].to_f * GeoRecord::SCALE lat << n["lat"].to_f * GeoRecord::SCALE @@ -256,7 +256,7 @@ class ChangesetController < ApplicationController end if params[:display_name] - user = User.find_by_display_name(params[:display_name]) + user = User.find_by(:display_name => params[:display_name]) if !user || !user.active? render_unknown_user params[:display_name] return @@ -481,7 +481,7 @@ class ChangesetController < ApplicationController raise OSM::APIBadUserInput.new("invalid user ID") if user.to_i < 1 u = User.find(user.to_i) else - u = User.find_by_display_name(name) + u = User.find_by(:display_name => name) end # make sure we found a user @@ -535,10 +535,10 @@ class ChangesetController < ApplicationController # if parameter 'open' is nill then open and closed changesets are returned def conditions_open(changesets, open) if open.nil? - return changesets + changesets else - return changesets.where("closed_at >= ? and num_changes <= ?", - Time.now.getutc, Changeset::MAX_ELEMENTS) + changesets.where("closed_at >= ? and num_changes <= ?", + Time.now.getutc, Changeset::MAX_ELEMENTS) end end @@ -547,10 +547,10 @@ class ChangesetController < ApplicationController # ('closed at' time has passed or changes limit is hit) def conditions_closed(changesets, closed) if closed.nil? - return changesets + changesets else - return changesets.where("closed_at < ? or num_changes > ?", - Time.now.getutc, Changeset::MAX_ELEMENTS) + changesets.where("closed_at < ? or num_changes > ?", + Time.now.getutc, Changeset::MAX_ELEMENTS) end end @@ -559,12 +559,12 @@ class ChangesetController < ApplicationController # (either specified as array or comma-separated string) def conditions_ids(changesets, ids) if ids.nil? - return changesets + changesets elsif ids.empty? raise OSM::APIBadUserInput.new("No changesets were given to search for") else ids = ids.split(",").collect(&:to_i) - return changesets.where(:id => ids) + changesets.where(:id => ids) end end