about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-02-03 18:57:38 +0100
committerGitHub <noreply@github.com>2021-02-03 18:57:38 +0100
commit4ed9576cd28abc033a094fed6babe9825014f1af (patch)
treed6d5e7b07e24248da5c237726dca874727c10b38 /app/controllers/api
parent7632255115a7f6e6f9f8047f0d0d1b90d7ee9315 (diff)
parente1fa06c459a28a575d0da540432c61b702e99cdd (diff)
Merge pull request #1496 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
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