X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4028f4cdb91f616bc774dc9b9fa8c7183eb1f6dd..945ff7911ca51dc250ffaba71f62821b5c0c0a95:/app/controllers/amf_controller.rb diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index f2b592b49..9cd685748 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -151,7 +151,7 @@ class AmfController < ApplicationController cs = Changeset.find(closeid.to_i) cs.set_closed_time_now if cs.user_id != user.id - fail OSM::APIUserChangesetMismatchError.new + raise OSM::APIUserChangesetMismatchError.new elsif closecomment.empty? cs.save! else @@ -189,11 +189,11 @@ class AmfController < ApplicationController def getpresets(usertoken, lang) #:doc: user = getuser(usertoken) - if user && !user.languages.empty? - langs = Locale.list(user.languages) - else - langs = Locale.list(http_accept_language.user_preferred_languages) - end + langs = if user && !user.languages.empty? + Locale.list(user.languages) + else + Locale.list(http_accept_language.user_preferred_languages) + end lang = getlocales.preferred(langs) (real_lang, localised) = getlocalized(lang.to_s) @@ -471,11 +471,11 @@ class AmfController < ApplicationController return -1, t("application.setup_user_auth.blocked") if user.blocks.active.exists? query = Trace.visible_to(user) - if searchterm.to_i > 0 - query = query.where(:id => searchterm.to_i) - else - query = query.where("MATCH(name) AGAINST (?)", searchterm).limit(21) - end + query = if searchterm.to_i > 0 + query.where(:id => searchterm.to_i) + else + query.where("MATCH(name) AGAINST (?)", searchterm).limit(21) + end gpxs = query.collect do |gpx| [gpx.id, gpx.name, gpx.description] end @@ -677,7 +677,7 @@ class AmfController < ApplicationController # -- Save revised way - pointlist.collect! do|a| + pointlist.collect! do |a| renumberednodes[a] ? renumberednodes[a] : a end # renumber nodes new_way = Way.new @@ -868,11 +868,10 @@ class AmfController < ApplicationController def getuser(token) #:doc: if token =~ /^(.+)\:(.+)$/ - user = User.authenticate(:username => $1, :password => $2) + User.authenticate(:username => $1, :password => $2) else - user = User.authenticate(:token => token) + User.authenticate(:token => token) end - user end def getlocales