fixed a pile of notification craziness

addes some tests around post timings
This commit is contained in:
Sam Saffron
2013-02-25 18:42:42 +11:00
parent cb3d839104
commit 77a2d8ccc4
7 changed files with 116 additions and 49 deletions

View File

@ -27,8 +27,8 @@ class Notification < ActiveRecord::Base
where(read: false)
end
def self.mark_post_read(user, topic_id, post_number)
Notification.update_all "read = true", ["user_id = ? and topic_id = ? and post_number = ?", user.id, topic_id, post_number]
def self.mark_posts_read(user, topic_id, post_numbers)
Notification.update_all "read = 't'", ["user_id = ? and topic_id = ? and post_number in (?) and read = ?", user.id, topic_id, post_numbers, false]
end
def self.recent