SECURITY: Unread post notifications should respect whispers

This commit is contained in:
Robin Ward
2015-10-19 16:31:48 -04:00
parent 32bc9a8f93
commit eacd75bcf8
2 changed files with 16 additions and 1 deletions

View File

@@ -51,7 +51,8 @@ class PostAlerter
end
def unread_posts(user, topic)
Post.where('post_number > COALESCE((
Post.secured(Guardian.new(user))
.where('post_number > COALESCE((
SELECT last_read_post_number FROM topic_users tu
WHERE tu.user_id = ? AND tu.topic_id = ? ),0)',
user.id, topic.id)