mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 16:49:08 +01:00
14 lines
382 B
Ruby
14 lines
382 B
Ruby
# frozen_string_literal: true
|
|
|
|
module User::NotificationMethods
|
|
def unread_notification_count
|
|
Rails.cache.fetch("#{notification_cache_key}/unread_notification_count") do
|
|
count = Notification.for(self).where(new: true).count
|
|
return nil unless count.positive?
|
|
|
|
count
|
|
end
|
|
end
|
|
|
|
def notification_cache_key = "#{cache_key}-#{notifications_updated_at}"
|
|
end
|