File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
app/controllers/notifications Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11class Notifications ::TraysController < ApplicationController
2+ MAX_ENTRIES_LIMIT = 100
3+
24 def show
3- @notifications = Current . user . notifications . preloaded . unread . ordered . limit ( 100 )
5+ @notifications = unread_notifications + read_notifications
46
57 # Invalidate on the whole set instead of the unread set since the max updated at in the unread set
68 # can stay the same when reading old notifications.
79 fresh_when Current . user . notifications
810 end
11+
12+ private
13+ def unread_notifications
14+ Current . user . notifications . preloaded . unread . ordered . limit ( MAX_ENTRIES_LIMIT )
15+ end
16+
17+ def read_notifications
18+ Current . user . notifications . preloaded . read . ordered . limit ( MAX_ENTRIES_LIMIT )
19+ end
920end
You can’t perform that action at this time.
0 commit comments