DEV: Remove deprecated User#saw_notification_id method (#27175)

This commit is contained in:
Ted Johansson 2024-05-27 11:10:46 +08:00 committed by GitHub
parent 581dbca97f
commit cb592ae4ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 13 deletions

View File

@ -788,18 +788,6 @@ class User < ActiveRecord::Base
Reviewable.list_for(self, include_claimed_by_others: false).count Reviewable.list_for(self, include_claimed_by_others: false).count
end end
def saw_notification_id(notification_id)
Discourse.deprecate(<<~TEXT, since: "2.9", drop_from: "3.0")
User#saw_notification_id is deprecated. Please use User#bump_last_seen_notification! instead.
TEXT
if seen_notification_id.to_i < notification_id.to_i
update_columns(seen_notification_id: notification_id.to_i)
true
else
false
end
end
def bump_last_seen_notification! def bump_last_seen_notification!
query = self.notifications.visible query = self.notifications.visible
query = query.where("notifications.id > ?", seen_notification_id) if seen_notification_id query = query.where("notifications.id > ?", seen_notification_id) if seen_notification_id

View File

@ -114,7 +114,6 @@ after_initialize do
notification = Notification.where(topic_id: topic.id, post_number: first_post.post_number).first notification = Notification.where(topic_id: topic.id, post_number: first_post.post_number).first
if notification.present? if notification.present?
Notification.read(self, notification.id) Notification.read(self, notification.id)
self.saw_notification_id(notification.id)
self.reload self.reload
self.publish_notifications_state self.publish_notifications_state
end end