From b61430163ba983f1d8a1d762f4eec743ed7ffab1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 3 Sep 2018 12:03:23 +0000 Subject: [PATCH] user: add moderator_user_query() --- lib/pleroma/user.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 64c69b209..1dad30e87 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -609,6 +609,14 @@ def local_user_query() do ) end + def moderator_user_query() do + from( + u in User, + where: u.local == true, + where: fragment("?->'is_moderator' @> 'true'", u.info) + ) + end + def deactivate(%User{} = user) do new_info = Map.put(user.info, "deactivated", true) cs = User.info_changeset(user, %{info: new_info})