optimise notifications query
[akkoma] / lib / pleroma / web / mastodon_api / mastodon_api.ex
index 23846b36a0a3101784b2e27358b5de14407c26c3..69bc2f0d6e49227b461a3f7f39ad92beee9eba97 100644 (file)
@@ -63,11 +63,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
   def get_notifications(user, params \\ %{}) do
     options = cast_params(params)
 
-    user
-    |> Notification.for_user_query(options)
-    |> restrict(:include_types, options)
-    |> restrict(:exclude_types, options)
-    |> restrict(:account_ap_id, options)
+    query =
+      user
+      |> Notification.for_user_query(options)
+      |> restrict(:include_types, options)
+      |> restrict(:exclude_types, options)
+      |> restrict(:account_ap_id, options)
+
+    IO.inspect(Pleroma.Repo.to_sql(:all, query))
+
+    query
     |> Pagination.fetch_paginated(params)
   end