mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
PERF: don't publish notification state unless it changed
This commit is contained in:
parent
eaab27325d
commit
9f4efed03a
1 changed files with 8 additions and 2 deletions
|
@ -35,8 +35,14 @@ class Notification < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.mark_posts_read(user, topic_id, post_numbers)
|
||||
Notification.where(user_id: user.id, topic_id: topic_id, post_number: post_numbers, read: false).update_all "read = 't'"
|
||||
user.publish_notifications_state
|
||||
count = Notification
|
||||
.where(user_id: user.id,
|
||||
topic_id: topic_id,
|
||||
post_number: post_numbers,
|
||||
read: false)
|
||||
.update_all("read = 't'")
|
||||
|
||||
user.publish_notifications_state if count > 0
|
||||
end
|
||||
|
||||
def self.interesting_after(min_date)
|
||||
|
|
Loading…
Reference in a new issue