Remove ordered_inbox method and related paginator

This commit is contained in:
Andreas Nedbal 2024-01-27 20:24:29 +01:00 committed by Andreas Nedbal
parent d12e3b020e
commit 020b7db712
1 changed files with 0 additions and 12 deletions

View File

@ -1,18 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
module User::InboxMethods module User::InboxMethods
include CursorPaginatable
define_cursor_paginator :cursored_inbox, :ordered_inbox
# @return [ActiveRecord::Relation<InboxEntry>] the user's inbox entries
def ordered_inbox
inbox_entries
.includes(:question, user: :profile)
.order(:created_at)
.reverse_order
end
def unread_inbox_count def unread_inbox_count
Rails.cache.fetch(inbox_cache_key, expires_in: 12.hours) do Rails.cache.fetch(inbox_cache_key, expires_in: 12.hours) do
count = InboxEntry.where(new: true, user_id: id).count(:id) count = InboxEntry.where(new: true, user_id: id).count(:id)