From: Tom Hughes Date: Sat, 21 May 2011 11:11:40 +0000 (+0100) Subject: Merge branch 'openID' of git://git.openstreetmap.org/rails into openid X-Git-Tag: live~6279 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/9cb8311f02e1bd0e2188e3b1db623400aaf8da47?hp=426778dd2acf52ad662f711cc30f96493f1d157d Merge branch 'openID' of git://git.openstreetmap.org/rails into openid --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6c32b74b2..bc71f275f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -134,8 +134,7 @@ class ApplicationController < ActionController::Base def check_api_readable if STATUS == :database_offline or STATUS == :api_offline - response.headers['Error'] = "Database offline for maintenance" - render :nothing => true, :status => :service_unavailable + report_error "Database offline for maintenance", :service_unavailable return false end end @@ -143,16 +142,14 @@ class ApplicationController < ActionController::Base def check_api_writable if STATUS == :database_offline or STATUS == :database_readonly or STATUS == :api_offline or STATUS == :api_readonly - response.headers['Error'] = "Database offline for maintenance" - render :nothing => true, :status => :service_unavailable + report_error "Database offline for maintenance", :service_unavailable return false end end def require_public_data unless @user.data_public? - response.headers['Error'] = "You must make your edits public to upload new data" - render :nothing => true, :status => :forbidden + report_error "You must make your edits public to upload new data", :forbidden return false end end @@ -165,7 +162,18 @@ class ApplicationController < ActionController::Base def report_error(message, status = :bad_request) # Todo: some sort of escaping of problem characters in the message response.headers['Error'] = message - render :text => message, :status => status + + if request.headers['X-Error-Format'] and + request.headers['X-Error-Format'].downcase == "xml" + result = OSM::API.new.get_xml_doc + result.root.name = "osmError" + result.root << (XML::Node.new("status") << interpret_status(status)) + result.root << (XML::Node.new("message") << message) + + render :text => result.to_s, :content_type => "text/xml" + else + render :text => message, :status => status + end end def set_locale diff --git a/app/models/user.rb b/app/models/user.rb index 43f1bd851..79af5d71f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,7 +10,7 @@ class User < ActiveRecord::Base has_many :friends, :include => :befriendee, :conditions => "users.status IN ('active', 'confirmed')" has_many :tokens, :class_name => "UserToken" has_many :preferences, :class_name => "UserPreference" - has_many :changesets + has_many :changesets, :order => 'created_at DESC' has_many :client_applications has_many :oauth_tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application] @@ -108,7 +108,7 @@ class User < ActiveRecord::Base (languages & array.collect { |i| i.to_s }).first end - def nearby(radius = 50, num = 10) + def nearby(radius = NEARBY_RADIUS, num = NEARBY_USERS) if self.home_lon and self.home_lat gc = OSM::GreatCircle.new(self.home_lat, self.home_lon) bounds = gc.bounds(radius) diff --git a/app/views/browse/_changeset_details.html.erb b/app/views/browse/_changeset_details.html.erb index 6e3cbdb2e..9fb9cb860 100644 --- a/app/views/browse/_changeset_details.html.erb +++ b/app/views/browse/_changeset_details.html.erb @@ -84,7 +84,7 @@ <% @relations.each do |relation| %> - + <% end %>
<%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => "relation " %>
<%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %>
diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index 2eae3963a..4497e7e81 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -130,14 +130,14 @@ <% end %>
- <%= t 'layouts.help_and_wiki', - :help => link_to(t('layouts.help'), t('layouts.help_url'), :title => t('layouts.help_title')), - :wiki => link_to(t('layouts.wiki'), t('layouts.wiki_url'), :title => t('layouts.wiki_title')) - %>
- <%= link_to t('layouts.copyright'), {:controller => 'site', :action => 'copyright'} %>
- <%= t 'layouts.news_blog' %>
- <%= t 'layouts.shop' %>
- <%= yield :left_menu %> +
<%= yield :optionals %> diff --git a/app/views/site/_key.html.erb b/app/views/site/_key.html.erb index e990071c8..6fc70ef46 100644 --- a/app/views/site/_key.html.erb +++ b/app/views/site/_key.html.erb @@ -29,5 +29,5 @@ <% content_for :left_menu do %> - <%= link_to_function t('site.key.map_key'), "openMapKey()", :title => t('site.key.map_key_tooltip') %> +
  • <%= link_to_function t('site.key.map_key'), "openMapKey()", :title => t('site.key.map_key_tooltip') %>
  • <% end %> diff --git a/app/views/site/_potlatch.html.erb b/app/views/site/_potlatch.html.erb index 68205b6ff..18e1c4cce 100644 --- a/app/views/site/_potlatch.html.erb +++ b/app/views/site/_potlatch.html.erb @@ -8,7 +8,7 @@