about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-02-08 15:01:01 -0600
committerStarfall <us@starfall.systems>2021-02-08 15:01:01 -0600
commit3693000bf6a94219e3cc4a29a6cb4ac51b78cf2a (patch)
tree5e0a9757d315ca3aafe4db1ce10d3c4d84769408 /app/controllers/api
parentab4c09a7041050e4aa4b8333484e311f26a36b4a (diff)
parent4ed9576cd28abc033a094fed6babe9825014f1af (diff)
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/notifications_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/api/v1/notifications_controller.rb b/app/controllers/api/v1/notifications_controller.rb
index fda348265..eefd28d45 100644
--- a/app/controllers/api/v1/notifications_controller.rb
+++ b/app/controllers/api/v1/notifications_controller.rb
@@ -40,12 +40,13 @@ class Api::V1::NotificationsController < Api::BaseController
   private
 
   def load_notifications
-    cache_collection_paginated_by_id(
-      browserable_account_notifications,
-      Notification,
+    notifications = browserable_account_notifications.includes(from_account: :account_stat).to_a_paginated_by_id(
       limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
       params_slice(:max_id, :since_id, :min_id)
     )
+    Notification.preload_cache_collection_target_statuses(notifications) do |target_statuses|
+      cache_collection(target_statuses, Status)
+    end
   end
 
   def browserable_account_notifications