Commit cf845fd0 by Arjun Singh

Change unread to read

parent 96fb9e26
...@@ -185,19 +185,19 @@ class CommentThread < Content ...@@ -185,19 +185,19 @@ class CommentThread < Content
:updated_at => {:$gte => last_read_time}, :updated_at => {:$gte => last_read_time},
:author_id => {:$ne => params[:user_id]}, :author_id => {:$ne => params[:user_id]},
).count ).count
unread = last_read_time >= self.updated_at read = last_read_time >= self.updated_at
else else
unread_count = self.comments.where(:author_id => {:$ne => params[:user_id]}).count unread_count = self.comments.where(:author_id => {:$ne => params[:user_id]}).count
unread = false read = false
end end
else else
# If there's no user, say it's unread and all comments are unread # If there's no user, say it's unread and all comments are unread
unread_count = comments_count unread_count = comments_count
unread = false read = false
end end
doc = doc.merge("unread_comments_count" => unread_count) doc = doc.merge("unread_comments_count" => unread_count)
.merge("unread" => unread) .merge("read" => read)
.merge("comments_count" => comments_count) .merge("comments_count" => comments_count)
doc doc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment