Reuse query from User.restrict_deactivated/1
authorEgor Kislitsyn <egor@kislitsyn.com>
Tue, 14 May 2019 11:29:10 +0000 (18:29 +0700)
committerEgor Kislitsyn <egor@kislitsyn.com>
Tue, 14 May 2019 11:29:10 +0000 (18:29 +0700)
lib/pleroma/user.ex
lib/pleroma/user/query.ex

index cf378d46772d73f41bee44e5dcbb3547e3f488a1..3eb684c3ac9593ff67476000ceca12515f4a67d1 100644 (file)
@@ -115,7 +115,7 @@ defmodule Pleroma.User do
     }
   end
 
-  defp restrict_deactivated(query) do
+  def restrict_deactivated(query) do
     from(u in query,
       where: not fragment("? \\? 'deactivated' AND ?->'deactivated' @> 'true'", u.info, u.info)
     )
index 3873ef80c15c007a208c54c18fcf8c0475c5337f..ace9c05f2555257d871113a13be87ddd50374c3f 100644 (file)
@@ -119,9 +119,7 @@ defmodule Pleroma.User.Query do
   end
 
   defp compose_query({:deactivated, false}, query) do
-    from(u in query,
-      where: not fragment("? \\? 'deactivated' AND ?->'deactivated' @> 'true'", u.info, u.info)
-    )
+    User.restrict_deactivated(query)
   end
 
   defp compose_query({:deactivated, true}, query) do