app/models/formol/forum.rb in formol-0.0.4 vs app/models/formol/forum.rb in formol-0.0.5
- old
+ new
@@ -71,7 +71,18 @@
# Unregister a post by re-assigning last post.
# Needed when a post is destroyed
def unregister_last_post
update_attributes!(:last_post => posts.order('formol_posts.id').last)
end
+
+ # Mark all unread topics as read for a given user
+ def mark_as_read(user)
+ topics.unread(user).each do |unread|
+ unread.track_for_user!(user)
+ end
+ end
+
+ def read?(user)
+ topics.unread(user).blank?
+ end
end
end