DEV: Wire up the dimiss button in the new notifications menu (#17745)

This commit is a subset of the changes proposed in https://github.com/discourse/discourse/pull/17379.
This commit is contained in:
Osama Sayegh
2022-08-03 15:32:35 +03:00
committed by GitHub
parent 03c9c3da76
commit 062a5f316d
10 changed files with 262 additions and 10 deletions

View File

@@ -148,6 +148,12 @@ class Notification < ActiveRecord::Base
.update_all(read: true)
end
def self.read_types(user, types = nil)
query = Notification.where(user_id: user.id, read: false)
query = query.where(notification_type: types) if types
query.update_all(read: true)
end
def self.interesting_after(min_date)
result = where("created_at > ?", min_date)
.includes(:topic)