Hide diary entries and comments made by deleted users.
This commit is contained in:
parent
b13278c815
commit
6a5749c55c
2 changed files with 8 additions and 3 deletions
|
@ -69,7 +69,8 @@ class DiaryEntryController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@title = "Users' diaries"
|
@title = "Users' diaries"
|
||||||
@entry_pages, @entries = paginate(:diary_entries,
|
@entry_pages, @entries = paginate(:diary_entries, :include => :user,
|
||||||
|
:conditions => "users.visible = 1",
|
||||||
:order => 'created_at DESC',
|
:order => 'created_at DESC',
|
||||||
:per_page => 20)
|
:per_page => 20)
|
||||||
end
|
end
|
||||||
|
@ -90,7 +91,9 @@ class DiaryEntryController < ApplicationController
|
||||||
render :nothing => true, :status => :not_found
|
render :nothing => true, :status => :not_found
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@entries = DiaryEntry.find(:all, :order => 'created_at DESC', :limit => 20)
|
@entries = DiaryEntry.find(:all, :include => :user,
|
||||||
|
:conditions => "users.visible = 1",
|
||||||
|
:order => 'created_at DESC', :limit => 20)
|
||||||
@title = "OpenStreetMap diary entries"
|
@title = "OpenStreetMap diary entries"
|
||||||
@description = "Recent diary entries from users of OpenStreetMap"
|
@description = "Recent diary entries from users of OpenStreetMap"
|
||||||
@link = "http://www.openstreetmap.org/diary"
|
@link = "http://www.openstreetmap.org/diary"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class DiaryEntry < ActiveRecord::Base
|
class DiaryEntry < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :diary_comments, :order => "id"
|
has_many :diary_comments, :include => :user,
|
||||||
|
:conditions => "users.visible = 1",
|
||||||
|
:order => "id"
|
||||||
|
|
||||||
validates_presence_of :title, :body
|
validates_presence_of :title, :body
|
||||||
validates_numericality_of :latitude, :allow_nil => true
|
validates_numericality_of :latitude, :allow_nil => true
|
||||||
|
|
Loading…
Add table
Reference in a new issue