don't mail out deleted stories or comments
This commit is contained in:
parent
0ac51b9f8c
commit
b710f85797
|
@ -48,7 +48,7 @@ mailing_list_users = User.where(:mailing_list_enabled => true)
|
||||||
|
|
||||||
last_story_id = (Keystore.value_for(LAST_STORY_KEY) || Story.last.id).to_i
|
last_story_id = (Keystore.value_for(LAST_STORY_KEY) || Story.last.id).to_i
|
||||||
|
|
||||||
Story.where("id > ?", last_story_id).order(:id).each do |s|
|
Story.where("id > ? AND is_expired = ?", last_story_id, false).order(:id).each do |s|
|
||||||
s.fetch_story_cache!
|
s.fetch_story_cache!
|
||||||
|
|
||||||
if s.story_cache.blank?
|
if s.story_cache.blank?
|
||||||
|
@ -118,7 +118,8 @@ Keystore.put(LAST_STORY_KEY, last_story_id)
|
||||||
last_comment_id = (Keystore.value_for(LAST_COMMENT_KEY) ||
|
last_comment_id = (Keystore.value_for(LAST_COMMENT_KEY) ||
|
||||||
Comment.last.id).to_i
|
Comment.last.id).to_i
|
||||||
|
|
||||||
Comment.where("id > ?", last_comment_id).order(:id).each do |c|
|
Comment.where("id > ? AND (is_deleted = ? AND is_moderated = ?)",
|
||||||
|
last_comment_id, false, false).order(:id).each do |c|
|
||||||
mailing_list_users.each do |u|
|
mailing_list_users.each do |u|
|
||||||
if (c.story.tags.map{|t| t.id } & u.tag_filters.map{|t| t.tag_id }).any?
|
if (c.story.tags.map{|t| t.id } & u.tag_filters.map{|t| t.tag_id }).any?
|
||||||
next
|
next
|
||||||
|
|
Loading…
Reference in a new issue