Restrict User Directory results more based on privacy

This commit is contained in:
Robin Ward 2015-03-20 11:32:28 -04:00
parent 43ebd88505
commit 9f22be2865
1 changed files with 5 additions and 0 deletions

View File

@ -44,11 +44,16 @@ class DirectoryItem < ActiveRecord::Base
LEFT OUTER JOIN user_actions AS ua ON ua.user_id = u.id LEFT OUTER JOIN user_actions AS ua ON ua.user_id = u.id
LEFT OUTER JOIN topics AS t ON ua.target_topic_id = t.id LEFT OUTER JOIN topics AS t ON ua.target_topic_id = t.id
LEFT OUTER JOIN posts AS p ON ua.target_post_id = p.id LEFT OUTER JOIN posts AS p ON ua.target_post_id = p.id
LEFT OUTER JOIN categories AS c ON t.category_id = c.id
WHERE u.active WHERE u.active
AND NOT u.blocked AND NOT u.blocked
AND COALESCE(ua.created_at, :since) >= :since AND COALESCE(ua.created_at, :since) >= :since
AND t.deleted_at IS NULL AND t.deleted_at IS NULL
AND COALESCE(t.visible, true)
AND COALESCE(t.archetype, 'regular') = 'regular'
AND p.deleted_at IS NULL AND p.deleted_at IS NULL
AND NOT (COALESCE(p.hidden, false))
AND NOT COALESCE(c.read_restricted, false)
AND u.id > 0 AND u.id > 0
GROUP BY u.id", GROUP BY u.id",
period_type: period_types[period_type], period_type: period_types[period_type],