Skip to content
Browse files

Fixed unread comments

  • Loading branch information...
1 parent 499be64 commit 5661741a9d76333da726e3999fb62865f908b77c @spob committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 app/models/forum.rb
View
5 app/models/forum.rb
@@ -82,14 +82,15 @@ def unread_topics user
sql = <<EOS
select topics.*
from topics
-where NOT EXISTS
+where topics.forum_id = ? AND
+NOT EXISTS
(select NULL
from user_topic_reads as utr
where utr.topic_id = topics.id
and utr.user_id = ?
and utr.updated_at > topics.last_commented_at)
EOS
- Topic.find_by_sql [sql, user.id]
+ Topic.find_by_sql [sql, self.id, user.id]
# topics.find_all { |topic| topic.unread_comment?(user) }
end

0 comments on commit 5661741

Please sign in to comment.
Something went wrong with that request. Please try again.