]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Merge branch 'master' into openid
[rails.git] / app / models / user.rb
index 1db8adab7fcea045f4b1a05516859a57aa579043..79af5d71f66c1836e69213aa812c7af32b66fcb2 100644 (file)
@@ -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]
@@ -23,6 +23,7 @@ class User < ActiveRecord::Base
   validates_confirmation_of :pass_crypt#, :message => ' must match the confirmation password'
   validates_uniqueness_of :display_name, :allow_nil => true
   validates_uniqueness_of :email
+  validates_uniqueness_of :openid_url, :allow_nil => true
   validates_length_of :pass_crypt, :within => 8..255
   validates_length_of :display_name, :within => 3..255, :allow_nil => true
   validates_email_format_of :email
@@ -107,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)