X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/c53db246f606e0233a524e8f3c6390ea74e96890..526ff061727cd1142350b08eae031294908d0b27:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 010cdf464..ed0813bee 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,6 +12,8 @@ class User < ActiveRecord::Base has_many :tokens, :class_name => "UserToken" has_many :preferences, :class_name => "UserPreference" has_many :changesets, -> { order(:created_at => :desc) } + has_many :changeset_comments, :foreign_key => :author_id + has_and_belongs_to_many :changeset_subscriptions, :class_name => 'Changeset', :join_table => 'changesets_subscribers', :foreign_key => 'subscriber_id' has_many :note_comments, :foreign_key => :author_id has_many :notes, :through => :note_comments @@ -45,6 +47,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