From b92c004ea8a9ecd066b8eddf755a07a175338416 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 14 May 2019 18:29:10 +0700 Subject: [PATCH] Reuse query from User.restrict_deactivated/1 --- lib/pleroma/user.ex | 2 +- lib/pleroma/user/query.ex | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index cf378d467..3eb684c3a 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -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) ) diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index 3873ef80c..ace9c05f2 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -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