Fix notifications
https://gitlab.com/soapbox-pub/soapbox/merge_requests/120/diffs#diff-content-917c7fb80cf426cfae1e7baaa21b3d90ccb2b29c
This commit is contained in:
@@ -74,6 +74,17 @@ class Notification < ApplicationRecord
|
||||
type != :follow_request
|
||||
end
|
||||
|
||||
def mark_read!
|
||||
user = account.user
|
||||
is_newer = self.id > (user.last_read_notification || -1)
|
||||
|
||||
if is_newer
|
||||
user.last_read_notification = self.id
|
||||
user.save!
|
||||
else false
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
def cache_ids
|
||||
select(:id, :updated_at, :activity_type, :activity_id)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
# chosen_languages :string is an Array
|
||||
# created_by_application_id :bigint(8)
|
||||
# approved :boolean default(TRUE), not null
|
||||
# last_read_notification :bigint(8)
|
||||
#
|
||||
|
||||
class User < ApplicationRecord
|
||||
|
||||
Reference in New Issue
Block a user