X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/38640e0253e8984974d275f2c232eb057ba86c84..424b6ef1cf760c4a3e27ac1e6f612ae42a9cd493:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 7a8414ec0..352c58fb5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -73,6 +73,12 @@ class User < ActiveRecord::Base has_many :roles, :class_name => "UserRole" + has_many :issues, :class_name => "Issue", :foreign_key => :reported_user_id + has_one :issue, :class_name => "Issue", :foreign_key => :updated_by + has_many :issue_comments + + has_many :reports + scope :visible, -> { where(:status => %w[pending active confirmed]) } scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } @@ -277,9 +283,7 @@ class User < ActiveRecord::Base ## # perform a spam check on a user def spam_check - if status == "active" && spam_score > SPAM_THRESHOLD - update(:status => "suspended") - end + update(:status => "suspended") if status == "active" && spam_score > SPAM_THRESHOLD end ##