mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 06:29:08 +01:00
Remove ordered_inbox method and related paginator
This commit is contained in:
parent
d12e3b020e
commit
020b7db712
1 changed files with 0 additions and 12 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue