mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:37:06 +08:00
PERF: don't publish notification state unless it changed
This commit is contained in:
parent
eaab27325d
commit
9f4efed03a
|
@ -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 New Issue
Block a user