X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/38640e0253e8984974d275f2c232eb057ba86c84..d5e6acaaceb5e74a76369bdfb9413d26ba99e721:/app/models/note.rb?ds=sidebyside diff --git a/app/models/note.rb b/app/models/note.rb index b7f6928b8..d96addbe7 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -21,7 +21,7 @@ class Note < ActiveRecord::Base include GeoRecord - has_many :comments, -> { where(:visible => true).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id + has_many :comments, -> { left_joins(:author).where(:visible => true, :users => { :status => [nil, "active", "confirmed"] }).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id validates :id, :uniqueness => true, :presence => { :on => :update }, :numericality => { :on => :update, :integer_only => true } @@ -31,8 +31,8 @@ class Note < ActiveRecord::Base validate :validate_position - scope :visible, -> { where("status != 'hidden'") } - scope :invisible, -> { where("status = 'hidden'") } + scope :visible, -> { where.not(:status => "hidden") } + scope :invisible, -> { where(:status => "hidden") } after_initialize :set_defaults