]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Add some more model tests for notes and note comments
[rails.git] / app / models / user.rb
index 81154fff7ad9dcabed5f7045da7b76b119046e68..9c1d82ba83218576cca3cd645a3292502f6605f0 100644 (file)
@@ -26,7 +26,7 @@ class User < ActiveRecord::Base
 
   scope :visible, -> { where(:status => ["pending", "active", "confirmed"]) }
   scope :active, -> { where(:status => ["active", "confirmed"]) }
-  scope :public, -> { where(:data_public => true) }
+  scope :identifiable, -> { where(:data_public => true) }
 
   has_attached_file :image,
     :default_url => "/assets/:class/:attachment/:style.png",
@@ -45,6 +45,7 @@ class User < ActiveRecord::Base
   validates_format_of :display_name, :with => /\A[^\x00-\x1f\x7f\ufffe\uffff\/;.,?%#]*\z/, :if => Proc.new { |u| u.display_name_changed? }
   validates_format_of :display_name, :with => /\A\S/, :message => "has leading whitespace", :if => Proc.new { |u| u.display_name_changed? }
   validates_format_of :display_name, :with => /\S\z/, :message => "has trailing whitespace", :if => Proc.new { |u| u.display_name_changed? }
+  validates_exclusion_of :display_name, :in => %w(new terms save confirm confirm-email go_public reset-password forgot-password suspended)
   validates_numericality_of :home_lat, :allow_nil => true
   validates_numericality_of :home_lon, :allow_nil => true
   validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true