]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Rather than referring how to view a bbox history, just redirect to the global history.
[rails.git] / app / models / user.rb
index 80faf68e9137c7ba60d2f75ef6073ed2f598e7d3..ce244fe02448bce114dbb79d25b6a009a4848f28 100644 (file)
@@ -9,6 +9,7 @@ class User < ActiveRecord::Base
   has_many :friends, :include => :befriendee, :conditions => ["users.visible = ?", true]
   has_many :tokens, :class_name => "UserToken"
   has_many :preferences, :class_name => "UserPreference"
+  has_many :changesets
 
   validates_presence_of :email, :display_name
   validates_confirmation_of :email, :message => 'Email addresses must match'
@@ -105,4 +106,21 @@ class User < ActiveRecord::Base
     return false
   end
 
+  def trace_public_default
+    return self.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"})
+  end
+
+  def delete
+    self.active = false
+    self.display_name = "user_#{self.id}"
+    self.description = nil
+    self.home_lat = nil
+    self.home_lon = nil
+    self.image = nil
+    self.email_valid = false
+    self.new_email = nil
+    self.visible = false
+    self.save
+  end
+
 end