Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy-nostream
[akkoma] / lib / pleroma / web / pleroma_api / controllers / chat_controller.ex
index e8a1746d46a82d459dedc10799c58e92f4af2063..27c9a2e0f77a0022019e21caa4b224ca9e81b6ae 100644 (file)
@@ -146,11 +146,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
     blocked_ap_ids = User.blocked_users_ap_ids(user)
 
     chats =
-      from(c in Chat,
-        where: c.user_id == ^user_id,
-        where: c.recipient not in ^blocked_ap_ids,
-        order_by: [desc: c.updated_at]
-      )
+      Chat.for_user_query(user_id)
+      |> where([c], c.recipient not in ^blocked_ap_ids)
       |> Repo.all()
 
     conn